0% found this document useful (0 votes)
48 views1 page

Sam15 Kubectl

This document provides a cheat sheet for common Kubectl commands for viewing, creating, interacting with, and modifying Kubernetes resources like pods, services, and deployments. It lists commands for listing, describing, applying, deleting resources as well as interacting with running pods through logs, exec, and metrics. Formatting options are also included to output resource details in different formats like YAML, JSON, wide, or custom columns.

Uploaded by

Atif Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views1 page

Sam15 Kubectl

This document provides a cheat sheet for common Kubectl commands for viewing, creating, interacting with, and modifying Kubernetes resources like pods, services, and deployments. It lists commands for listing, describing, applying, deleting resources as well as interacting with running pods through logs, exec, and metrics. Formatting options are also included to output resource details in different formats like YAML, JSON, wide, or custom columns.

Uploaded by

Atif Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Kubectl Cheat Sheet

by Sam15 via cheatography.com/127983/cs/24960/

Viewing and Finding Creating Objects Intera​cting with Running Pods Formatting Output
Resources
Create kubectl apply -f Dump pod logs kubectl logs Print a table using a -o=cus​‐
List all kubectl get resour​ce(s) ./my-m​ani​fes​‐ (stdout) my-pod comma separated list tom​-co​‐
namespaces namespaces t.yaml Dump pod logs, kubectl logs of custom columns lum​ns=​‐
in the cluster Create kubectl apply -f with label -l name=m​‐ <sp​ec>
List all kubectl get resour​ce(s) in ./dir name=m​yLabel yLabel Print a table using the -o=cus​‐
services in services all manifest (stdout) custom columns tom​-co​‐
the files in dir Dump pod logs kubectl logs template in the <fi​len​‐ lum​ns-​‐
namespace Create kubectl apply -f (stdout) for a my-pod -- ame> file fil​e=<​fil​‐
List all pods kubectl get resour​ce(s) https:​//g​it.i​o/​‐ previous instan​‐ previous ena​me>
in all pods --all-​nam​‐ from URL vPieo tiation of a Print only the -
namespaces espaces Start a single kubectl create container resource name and o=name
List all pods kubectl get instance of deployment Dump pod kubectl logs nothing else

in the pods -o wide nginx nginx --imag​‐ container logs my-pod -c Print the fields -o=jso​‐
namespace, e=nginx (stdout, multi-​‐ my-con​‐ defined in a jsonpath npa​th=​‐
with more Get the kubectl explain con​tainer case) tainer expression <te​mpl​‐
details docume​‐ pods Stream pod logs kubectl logs ate>
List a kubectl get ntation for (stdout) -f my-pod Print the fields -o=jso​‐
particular deployment my- pod manifests Stream pod kubectl logs defined by the npa​th-​‐
deployment dep container logs -f my-pod -c jsonpath expression fil​e=<​fil​‐
List all pods kubectl get Modifying and Deleting (stdout, multi-​‐ my-con​‐ in the <fi​len​ame> file ena​me>
in the pods Resources con​tainer case) tainer Output a YAML -o=yaml
namespace Add a kubectl label pods Run command in kubectl exec formatted API object
Get a pod's kubectl get pod label my-pod new-la​bel​‐ existing pod (1 my-pod -- ls Output in the plain- -o=wide
YAML my-pod -o yaml =aw​esome container case) / text format with any
List Services kubectl get Add an kubectl annotate Show metrics for kubectl top additional inform​‐
Sorted by services --sort​- annotation pods my-pod icon- a given pod and pod ation, and for pods,
Name by​=.m​eta​dat​‐ u​rl=​htt​p:/​/go​o.g​l/X​‐ its containers POD_NAME the node name is
a.name XBTWq --cont​ainers included

Get all kubectl get


running pods pods --fiel​d-s​‐
in the ele​cto​r=s​tat​‐
namespace us.p​ha​se=​‐
Running

By Sam15 Published 26th October, 2020. Sponsored by CrosswordCheats.com


cheatography.com/sam15/ Last updated 26th October, 2020. Learn to solve cryptic crosswords!
Page 1 of 1. http://crosswordcheats.com

You might also like