[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-572352-105":3,"detail-sidebar-cat-1-en-105":81,"doc-detail-572352-en":127},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","kubernetes-cheat-sheet-pods-command-reference","Kubernetes Cheat Sheet - Pods - command reference","","Kubernetes Cheat Sheet provides a compact command reference for common kubectl workflows across key resource types. It covers listing, inspecting, and exporting detailed YAML for Pods, Secrets, Services, Deployments, and Ingress objects, plus label-based selection and sorting. The sheet also includes operational commands for rolling updates, rollbacks, scaling, editing resources, node scheduling control, log retrieval and follow, namespace/context switching, and creating resources from files, directories, or URLs.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/template/","Template",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/template/presentations/","Presentations",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/template/kubernetes-cheat-sheet-pods-command-reference/572352/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/kubernetes-cheat-sheet-pods-command-reference/572352.png","ImageObject",442,249,{"name":42,"@type":43},"Rhys","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-21","2026-10-13",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",8,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"How do I list pods in the current namespace and in all namespaces?","Question",{"text":63,"@type":64},"Use kubectl get pods for the current namespace, and kubectl get pods --all-namespaces for all namespaces.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How can I inspect a pod and retrieve its YAML definition?",{"text":68,"@type":64},"Use kubectl describe pods \u003Cpod> to inspect the pod, and kubectl get pod \u003Cpod> -o yaml to fetch the pod’s YAML.",{"name":70,"@type":61,"acceptedAnswer":71},"What commands help with deployment updates, rollbacks, and scaling?",{"text":72,"@type":64},"Use kubectl rollout history deployment/\u003Cdeployment> to check history, kubectl rollout undo deployment/\u003Cdeployment> (or --to-revision=) for rollback, and kubectl scale --replicas=3 deployment/\u003Cdeployment> to scale a deployment.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},572352,1792033237,{"code":4,"msg":82,"data":83},"success",[84,88,93,98,103,108,113,118,123],{"id":85,"doc_module":22,"doc_module_name":25,"category_name":29,"show_sort_weight":86,"slug":87},11,90,"presentations",{"id":89,"doc_module":22,"doc_module_name":25,"category_name":90,"show_sort_weight":91,"slug":92},12,"Resumes",80,"resumes",{"id":94,"doc_module":22,"doc_module_name":25,"category_name":95,"show_sort_weight":96,"slug":97},14,"Invoices",70,"invoices",{"id":99,"doc_module":22,"doc_module_name":25,"category_name":100,"show_sort_weight":101,"slug":102},15,"Posters",60,"posters",{"id":104,"doc_module":22,"doc_module_name":25,"category_name":105,"show_sort_weight":106,"slug":107},16,"Social Media",50,"social-media",{"id":109,"doc_module":22,"doc_module_name":25,"category_name":110,"show_sort_weight":111,"slug":112},17,"Forms",40,"forms",{"id":114,"doc_module":22,"doc_module_name":25,"category_name":115,"show_sort_weight":116,"slug":117},18,"Letters",30,"letters",{"id":119,"doc_module":22,"doc_module_name":25,"category_name":120,"show_sort_weight":121,"slug":122},21,"Paper Templates",5,"papers-templates",{"id":124,"doc_module":22,"doc_module_name":25,"category_name":125,"show_sort_weight":4,"slug":126},158,"General","general-158",{"code":4,"msg":82,"data":128},{"doc_id":79,"user_id":129,"nickname":42,"user_avatar":130,"doc_module":22,"category_id":85,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":22,"language":136,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":12,"update_tm":140,"read_time":4},687207024643,"https://ap-avatar.wpscdn.com/davatar_3d24733baf745e90a7e4bdd5f77d97b2","Kubernetes Cheat Sheet  \nPods  \n\\# Get all pods in the current namespace  \nkubectl get pods  \n\\# Get pods in all namespaces  \nkubectl get pods--all-namespaces  \n\\# Get pods with more details  \nkubectl get pods-o wide  \n\\# Get the yaml for a pod  \nkubectl get pod \u003Cpod> -o yaml  \n\\# Inspect a pod  \nkubectl describe pods \u003Cpod>  \n\\# Get pods sorted by a metric  \nkubectl get pods \\--sort-by='.status.containerStatuses[0]. restartCount'  \n\\# Get pods with their labels  \nkubectl get pods--show-labels  \n\\# Get pods that match a label  \nkubectl get pods-l \u003Clabel>=\u003Cvalue>  \n\\# Forward traﬃc from a localhost port to a pod port  \nkubectl port-forward \u003Cpod> \u003Clocalhost-port>:\u003Cpod-port>  \n\\# Run a command on a pod  \nkubectl exec \u003Cpod> -- \u003Ccommand>  \n\\# Run a command on a container in a pod  \nkubectl exec \u003Cpod> -c \u003Ccontainer> -- \u003Ccommand>  \n\\# Get all secrets inkubectl get secrets  \n\\# Get secrets in all kubectl get secrets  \n\\# Get secrets with kubectl get secrets  \n\\# Get the contents kubectl get secrets  \nSecrets  \nthe current namespace  \nnamespaces  \n--all-namespaces  \nmore details  \n-o wide  \nof a secret  \n\u003Csecret> -o yaml  \nServices  \n\\# Get all services in the current namespace  \nkubectl get services  \n\\# Get services in all namespaces  \nkubectl get service--all-namespaces  \n\\# Get services with more details  \nkubectl get service-o wide  \n\\# Get the yaml for a services  \nkubectl get service \u003Cservice> -o yaml  \n\\# Inspect a service  \nkubectl describe service \u003Cservice>  \n\\# Get service's labels  \nkubectl get service--show-labels  \n\\# Get services that match a label  \nkubectl get service-l \u003Clabel>=\u003Cvalue>  \nUpdating Resources  \n\\# Roll a new version of a deployment  \nkubectl set image deployment/\u003Cdeployment> \u003Ccontainername>=image:\u003Cversion>  \n\\# Check the deployment history  \nkubectl rollout history deployment/\u003Cdeployment>  \n\\# Rollback a deployment  \nkubectl rollout undo deployment/\u003Cdeployment>  \n\\# Rollback to a speciﬁc version  \nkubectl rollout undo deployment/\u003Cdeployment> --to-revision=2  \n\\# Watch a rolling update  \nkubectl rollout status-w deployment/\u003Cdeployment>  \n\\# Restart the rolling deploy  \nkubectl rollout restart deployment/\u003Cdeployment>  \n\\# Edit a resource’s yaml  \nkubectl edit deployment/\u003Cdeployment>  \n\\# Scale a deployment to 3 pods  \nkubectl scale--replicas=3 deployment/\u003Cdeployment>  \n\\# Delete a pod  \nkubectl delete pod \u003Cpod>  \nContext  \n\\# Show contexts  \nkubectl conﬁg get-contexts  \n\\# Show current context  \nkubectl conﬁg current-context  \n\\# Switch context to another cluster  \nkubectl conﬁg use-context \u003Cmy-cluster-name>  \n\\# Change Namespace  \nkubectl conﬁg set-context--current--namespace=\u003Cnamespace>  \nLogs  \n\\# Show logs (stdout) of a pod  \nkubectl logs \u003Cpod>  \n\\# Show logs (stdout) of pods that match a label  \nkubectl logs-l \u003Clabel>=\u003Cvalue>  \n\\# Show logs of a previous instantiation of a container  \nkubectl logs \u003Cpod> --previous  \n\\# Show logs for a speciﬁc container in a pod (i.e. init container)  \nkubectl logs \u003Cpod> -c \u003Ccontainer>  \n\\# Following logs from a pod  \nkubectl logs-f \u003Cpod>  \n\\# Follow all logs from a pod that match a label  \nkubectl logs-f-l \u003Clabel>=\u003Cvalue> --all-containers  \n\\# Show logs with verbosity level of logs from 0-9  \nkubectl logs \u003Cpod> --v=\u003C0:9>  \nDeployments  \n\\# Get all deployments in the current namespace  \nkubectl get deployment  \n\\# Get deployments in all namespaces  \nkubectl get deployment--all-namespaces  \n\\# Get deployments with more details  \nkubectl get deployment-o wide  \n\\# Get the yaml for a deployment  \nkubectl get deployment \u003Cdeployment> -o yaml  \n\\# Inspect a deployment  \nkubectl describe deployment \u003Cdeployment>  \n\\# Get deployment's labels  \nkubectl get deployment--show-labels  \n\\# Get deployments that match a label  \nkubectl get deployment-l \u003Clabel>=\u003Cvalue>  \nIngress  \n\\# Get all ingress in the current namespace  \nkubectl get ingress  \n\\# Get ingress in all namespaces  \nkubectl get ingress--all-namespaces  \n\\# Get ingress with more details  \nkubectl get ingress-o wide  \n\\# Get","cbCail8keTt4F8ld","https://ap.wps.com/l/cbCail8keTt4F8ld","pdf",28303,"English","# Pods\n## Secrets\n## Services\n## Updating Resources\n## Context\n## Logs\n## Deployments\n## Ingress\n## Creating Resources\n## Nodes","[{\"question\":\"How do I list pods in the current namespace and in all namespaces?\",\"answer\":\"Use kubectl get pods for the current namespace, and kubectl get pods --all-namespaces for all namespaces.\"},{\"question\":\"How can I inspect a pod and retrieve its YAML definition?\",\"answer\":\"Use kubectl describe pods \\u003cpod\\u003e to inspect the pod, and kubectl get pod \\u003cpod\\u003e -o yaml to fetch the pod’s YAML.\"},{\"question\":\"What commands help with deployment updates, rollbacks, and scaling?\",\"answer\":\"Use kubectl rollout history deployment/\\u003cdeployment\\u003e to check history, kubectl rollout undo deployment/\\u003cdeployment\\u003e (or --to-revision=) for rollback, and kubectl scale --replicas=3 deployment/\\u003cdeployment\\u003e to scale a deployment.\"}]","Kubernetes Cheat Sheet - Pods - command reference | PDF",1791926889]