[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-572354-105":3,"detail-sidebar-cat-1-en-105":81,"doc-detail-572354-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-quick-kubectl-command-reference","Kubernetes Cheat Sheet - Quick kubectl Command Reference","","Kubernetes Cheat Sheet provides a compact, task-oriented reference for common kubectl workflows across namespaces, configuration, resource inspection, listing, deletion, command execution, and log retrieval. It includes commands for creating and applying resources from YAML/JSON, editing services and using alternate editors, switching and modifying kubeconfig contexts, describing nodes and pods in detail, listing resources with expanded output and selectors, deleting pods selectively or in bulk, executing commands inside containers, and streaming or printing container logs for operational debugging.",{"@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/general/","General",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/template/kubernetes-cheat-sheet-quick-kubectl-command-reference/572354/",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-quick-kubectl-command-reference/572354.png","ImageObject",442,249,{"name":42,"@type":43},"Jacob","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 you create a namespace and apply resources in Kubernetes with kubectl?","Question",{"text":63,"@type":64},"Use kubectl create namespace [namespacename] to create a namespace. Use kubectl create -f [filename] or kubectl apply -f ... .yaml to create resources from a file, a service definition, a controller definition, or a directory of manifests.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How can you inspect the current kubeconfig context and change cluster settings?",{"text":68,"@type":64},"Use kubectl config current-context to display the current context. Use kubectl config setcluster [clustername] --server=[server-name] to set a cluster entry, and kubectl config unset [property-name] to remove a kubeconfig entry.",{"name":70,"@type":61,"acceptedAnswer":71},"What kubectl commands help with debugging and viewing resource details?",{"text":72,"@type":64},"Use kubectl describe nodes [node-name] or kubectl describe pods [pod-name] to view detailed state. Use kubectl exec [podname] --[command] or kubectl exec -ti [pod-name] --/bin/bash to run commands in containers, and use kubectl logs [podname] or kubectl logs -f [podname] to print or stream logs.","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},572354,1792113647,{"code":4,"msg":82,"data":83},"success",[84,89,94,99,104,109,114,119,124],{"id":85,"doc_module":22,"doc_module_name":25,"category_name":86,"show_sort_weight":87,"slug":88},11,"Presentations",90,"presentations",{"id":90,"doc_module":22,"doc_module_name":25,"category_name":91,"show_sort_weight":92,"slug":93},12,"Resumes",80,"resumes",{"id":95,"doc_module":22,"doc_module_name":25,"category_name":96,"show_sort_weight":97,"slug":98},14,"Invoices",70,"invoices",{"id":100,"doc_module":22,"doc_module_name":25,"category_name":101,"show_sort_weight":102,"slug":103},15,"Posters",60,"posters",{"id":105,"doc_module":22,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},16,"Social Media",50,"social-media",{"id":110,"doc_module":22,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},17,"Forms",40,"forms",{"id":115,"doc_module":22,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},18,"Letters",30,"letters",{"id":120,"doc_module":22,"doc_module_name":25,"category_name":121,"show_sort_weight":122,"slug":123},21,"Paper Templates",5,"papers-templates",{"id":125,"doc_module":22,"doc_module_name":25,"category_name":29,"show_sort_weight":4,"slug":126},158,"general-158",{"code":4,"msg":82,"data":128},{"doc_id":79,"user_id":129,"nickname":42,"user_avatar":130,"doc_module":22,"category_id":125,"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},962084931830,"https://ap-avatar.wpscdn.com/davatar_a8503ba1806abce46bf441b54a3ca4cd","Kubernetes Cheat Sheet  \n\n| Creating and Updating a Resource |  |\n| --- | --- |\n| kubectl create namespace [namespacename] | Create a new namespace |\n| kubectl create –f [filename] | Create a resource from a JSON or YAML file |\n| kubectl apply -f [service-name] .yaml | Create a new service with the definition contained in [service-name].yaml |\n| kubectl apply -f [controllername] .yaml | Create a new replication controller with the definition contained in [controllername].yaml |\n| kubectl apply -f [directory-name] | Create the objects defined in any .yaml, .yml, or .json file in a directory |\n| kubectl edit\u003Cbr>svc/[service-name] | Edit a service |\n| KUBE_EDITOR=”[editorname]” kubectl editsvc/[service-name] | Edit a service in a nondefault editor |\n\n\n| Modifying kubeconfig Files |  |\n| --- | --- |\n| kubectl config current-context | Display the current context |\n| kubectl config setcluster [clustername] - -server=[server-name] | Set a cluster entry inkubeconfig |\n| kubectl config unset [property-name] | Unset an entry in kubeconfig |\n\n\n| Displaying the State of Resources |  |\n| --- | --- |\n| kubectl describe nodes [node-name] | See details about a particular node |\n| kubectl describe pods [pod-name] | See details about a particular pod |\n| Kubectl describe –fpod.json | See details about a pod whose name and type are listed in pod.json |\n| kubectl describe pods [replicationcontroller-name] | See details about all pods managed by a specific replication controller |\n| kubectl describe pods | See details about all pods |\n\nVisit us at   \n[ReviewNPrep. com](ReviewNPrep. com)  \n\n| Listing Resources |  |\n| --- | --- |\n| kubectl get namespaces | Generate a plain-text list of all namespaces |\n| kubectl get pods | Generate a plain-text list of all pods |\n| kubectl get pods -o wide | Generate a detailed plaintext list of all pods |\n| kubectl get pods --fieldselector=spec .nodeName=[server-name] | Generate a list of all pods running on a particular node server |\n| kubectl get\u003Cbr>replicationcontrolle\u003Cbr>r [replicationcontrollername] | List a specific replication controller in plain text |\n| kubectl get replicationcontroller, services | Generate a plain-text list of all replication controllers and services |\n| kubectl get deamonset | Generate a plain-text list of all daemon sets |\n\n\n| Deleting Resources |  |\n| --- | --- |\n| kubectl delete -f pod.yaml | Remove a pod using the name and type listed in pod.yaml |\n| kubectl delete pods,services -l [label-key]=[labelvalue] | Remove all the pods and services with a specific label |\n| kubectl delete pods –all | Remove all pods. The command will include uninitialized pods as well |\n\n\n| Executing a Command |  |\n| --- | --- |\n| kubectl exec [podname] --[command] | Receive output from a command run on the first container in a pod |\n| kubectl exec [podname] -c[container\u003Cbr>name] --[command] | Receive output from a command run on a specific container in a pod |\n| kubectl exec -ti [pod-name] --/bin/bash | Run /bin/bash from a specific pod. The output received comes from the first container |\n\n\n| Printing Container Logs |  |\n| --- | --- |\n| kubectl logs [podname] | Print logs from a pod |\n| kubectl logs -f [podname] | Stream logs from a pod |","cbCaik8bII5ZKSFX","https://ap.wps.com/l/cbCaik8bII5ZKSFX","pdf",104926,"English","# Creating and Updating a Resource\n# Modifying kubeconfig Files\n# Displaying the State of Resources\n# Listing Resources\n# Deleting Resources\n# Executing a Command\n# Printing Container Logs","[{\"question\":\"How do you create a namespace and apply resources in Kubernetes with kubectl?\",\"answer\":\"Use kubectl create namespace [namespacename] to create a namespace. Use kubectl create -f [filename] or kubectl apply -f ... .yaml to create resources from a file, a service definition, a controller definition, or a directory of manifests.\"},{\"question\":\"How can you inspect the current kubeconfig context and change cluster settings?\",\"answer\":\"Use kubectl config current-context to display the current context. Use kubectl config setcluster [clustername] --server=[server-name] to set a cluster entry, and kubectl config unset [property-name] to remove a kubeconfig entry.\"},{\"question\":\"What kubectl commands help with debugging and viewing resource details?\",\"answer\":\"Use kubectl describe nodes [node-name] or kubectl describe pods [pod-name] to view detailed state. Use kubectl exec [podname] --[command] or kubectl exec -ti [pod-name] --/bin/bash to run commands in containers, and use kubectl logs [podname] or kubectl logs -f [podname] to print or stream logs.\"}]","Kubernetes Cheat Sheet - Quick kubectl Command Reference | PDF",1791926895]