[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-571772-105":53,"doc-detail-571772-en":127},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":120,"head_meta":122,"extra_data":124,"updated_unix":126},105,"en","kubernetes-trouble-cheat-sheet-most-helpful-debugging-commands","Kubernetes Trouble Cheat Sheet - Most helpful debugging commands","","Kubernetes Trouble Cheat Sheet provides a practical set of troubleshooting and operational commands for diagnosing issues in Kubernetes clusters. It covers onboarding new clusters by managing kubeconfig files, contexts, users, namespaces, and cluster visibility, then helps investigate trouble via events, nodes, pods, resources, logs, and restart patterns. It also lists remediation steps such as rollout restart, rescaling, deleting stuck pods, cordoning/draining/tainting nodes, and deeper investigation using kubectl debug, port-forward, exec, and kubectl cp, plus core low-hanging best practices for secure, stable workloads.",{"@graph":63,"@context":119},[64,80,102],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/kubernetes-trouble-cheat-sheet-most-helpful-debugging-commands/571772/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/kubernetes-trouble-cheat-sheet-most-helpful-debugging-commands/571772.png","ImageObject",442,249,{"name":88,"@type":89},"awa","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-22","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",6,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"How do you configure multiple kubeconfig files for different clusters?","Question",{"text":109,"@type":110},"Set KUBECONFIG to a colon-separated list of config paths, for example using export KUBECONFIG=~/.kube/conf1:~/.kube/conf2:~/.kube/conf3. You can then merge them into one file with kubectl config view --flatten.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"What kubectl commands help identify cluster and workload issues?",{"text":114,"@type":110},"Use kubectl get events -A --sort-by=.metadata.creationTimestamp for recent events, kubectl get nodes -o wide to check readiness and versions, and kubectl top nodes and kubectl top pods for resource pressure. For workload detail, use kubectl describe node \u003Cnode_name> and kubectl get pods -o wide with sorting by restartCount.",{"name":116,"@type":107,"acceptedAnswer":117},"How can you investigate a suspected problem using a debug container or remote inspection?",{"text":118,"@type":110},"Launch a debug container with kubectl debug -it --container=debugger --image=alpine --target=namespace pod. Use kubectl port-forward to forward ports for debugging, kubectl exec -it to run commands inside a pod, and kubectl cp to copy files between pod and local machine.","https://schema.org",{"og:url":78,"og:type":121,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":123,"canonical":78},"index,follow",{"doc_id":125,"site_id":56},571772,1792359923,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":101,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":9,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":140,"read_time":4},3985747858093,"https://ap-avatar.wpscdn.com/davatar_3d24733baf745e90a7e4bdd5f77d97b2","Kubernetes Trouble Cheat Sheet  \nMost helpful debugging commands  \n\n| Onboard new cluster |  |\n| --- | --- |\n| Set multiple kubeconfig files | export KUBECONFIG=~/.kube/conf1:~/.kube/conf2:~/.kube/conf3 |\n| Merge multiple kubeconfig into one file | export KUBECONFIG=xxx kubectl config view--flatten > ~/.kube/merged-config |\n| Set user credentials | kubectl config set-credentials \u003Cuser-name> |\n| Display current kubeconfig | kubectl config view |\n| List contexts, find the new cluster | kubectl config get-contexts |\n| Switch to a specific context | kubectl config use-context \u003Ccluster name> |\n| Check connection and Versions | kubectl version // outdated? |\n| Show Cluster Info | kubectl cluster-info |\n| What namespaces can I access | kubectl get namespaces |\n| Set default namespace | kubectl config set-context--current--namespace=production |\n|  |  |\n| Let's look for trouble |  |\n| Show recent events | kubectl get events-A--sort-by=.metadata.creationTimestamp |\n| Show node status & version | kubectl get nodes-o wide // all nodes ready? |\n| Show node resource usage | kubectl top nodes // is a node super busy? |\n| Show node details | kubectl describe node \u003Cnode_name> |\n| Show restarting pods | kubectl get pods-o wide-A--sort-by='.status.containerStatuses[0].restartCount' |\n| Show busy pods | kubectl top pods--all-namespaces--sort-by=cpu |\n| Logs from all pods with label | kubectl logs--tail=500-l app=xxxx-f // use with | grep to filter |\n|  |  |\n| Turn it off and on again |  |\n| Redeploy all pods of a deployment | kubectl rollout restart deployment/myapp |\n| Rescale deployments | kubectl scale--current-replicas=2--replicas=3 deployment/mysql |\n| Delete stuck pods | kubectl delete pod unwanted--now |\n|  |  |\n| We need to dig deeper |  |\n| Launch a debug container | kubectl debug-it--container=debugger--image=alpine--target=namespace pod |\n| Forward a port to debug against | kubectl port-forward \u003Cpod name> \u003Cportliste>:\u003Cportforwar> |\n| Execute a command in a pod | kubectl exec-it \u003Cpod-name> -- /bin/bash |\n| Copy files over from pod to local | kubectl cp \u003Cpod-name>:\u003Cpath-to-file> \u003Cpath-to-local-file> -c \u003Ccontainer-name> |\n| Copy files over from local to pod | kubectl cp \u003Cpath-to-local-file> \u003Cpod-name>:\u003Cpath-to-file> |\n|  |  |\n| A node in trouble |  |\n| Mark node as unschedulable | kubectl cordon node \u003Cnode_name> |\n| Mark node as schedulable | kubectl uncordon node \u003Cnode_name> |\n| Evict all pods from a node | kubectl drain node \u003Cnode_name> |\n| Apply a taint to a node | kubectl taint node \u003Cnode_name> |\n| Add or modify annotations of a node | kubectl annotate node \u003Cnode_name> |\n|  |  |\n\nBest Practices-Low hanging fruits  \n1. Use namespaces 2. Use declarative conﬁguration with GitOps  \nUse a namespace for each logical partition to enable better access control with RBAC, apply network policies, prioritize computation resources with Resource Quotas, and simplify administration tasks.  \nNo direct edits with kubectl beyond troubleshooting! Use $ kubectl apply-f my-conf.yaml and make changes through YAML conﬁgurations to ensure reproducible deployments. Store these in version control. Even better: use a CI/CD pipeline to apply changes and give developers read-only permissions.  \n3. Use readiness and liveness probes 4. Don't run as root & immutable pods  \nWithout a readiness probe, a container will receive traffic right after launch, even if it might not be ready. Liveness probes check if the app is still alive and restart the container if it is not.  \nspec.containers:  \nlivenessProbe: [httpGet:](httpGet:)  \npath: /healthcheck  \nport: 8000  \nreadinessProbe:  \n[httpGet:](httpGet:)  \npath: /healthcheck  \nport: 8000  \nDon’t use the local ﬁlesystem to store state—containers should be stateless. Make pods immutable with‘readOnlyRootFilesystem’ and use ‘emptyDir’ volumes if ﬁle system writes are necessary. Don’t run processes with root privileges and block privilege escalation. This will signiﬁcantly reduce the attack surface.  \nspec.containers:  \nsecur","cbCaidEoVoqRtYeO","https://ap.wps.com/l/cbCaidEoVoqRtYeO","pdf",65732,"English","# Most helpful debugging commands\n## Onboard new cluster\n## Let's look for trouble\n## Turn it off and on again\n## We need to dig deeper\n## A node in trouble\n## Best Practices - low hanging fruits","[{\"question\":\"How do you configure multiple kubeconfig files for different clusters?\",\"answer\":\"Set KUBECONFIG to a colon-separated list of config paths, for example using export KUBECONFIG=~/.kube/conf1:~/.kube/conf2:~/.kube/conf3. You can then merge them into one file with kubectl config view --flatten.\"},{\"question\":\"What kubectl commands help identify cluster and workload issues?\",\"answer\":\"Use kubectl get events -A --sort-by=.metadata.creationTimestamp for recent events, kubectl get nodes -o wide to check readiness and versions, and kubectl top nodes and kubectl top pods for resource pressure. For workload detail, use kubectl describe node \\u003cnode_name\\u003e and kubectl get pods -o wide with sorting by restartCount.\"},{\"question\":\"How can you investigate a suspected problem using a debug container or remote inspection?\",\"answer\":\"Launch a debug container with kubectl debug -it --container=debugger --image=alpine --target=namespace pod. Use kubectl port-forward to forward ports for debugging, kubectl exec -it to run commands inside a pod, and kubectl cp to copy files between pod and local machine.\"}]","Kubernetes Trouble Cheat Sheet - Most helpful debugging commands | PDF",1791923666]