Your handy guide for troubleshooting Kubernetes clusters with a list of commonly used kubectl commands to display one or many resources when running commands against clusters. Click to copy to clipboard easily, or download the PDF cheatsheet as a useful reference.


kubectl config get-contexts
kubectl config current-context
kubectl config use-context [cluster_context_name]


kubectl logs [pod_name] -n [namespace]
kubectl logs -f [pod_name] -n [namespace]
kubectl logs -f [pod_name] -c [container_name] -n [namespace]
kubectl logs --tail=20 [pod_name] -n [namespace]
kubectl logs --since=1h [pod_name] -n [namespace]
kubectl logs --previous [pod_name] -n [namespace]
kubectl logs -l name=[label_name] -n [namespace]


kubectl cordon node [node_name]
kubectl uncordon node [node_name]
kubectl drain node [node_name]


kubectl get events --field-selector type=Warning

Not keen to commit these commands to memory? Let CAEPE handle them for you. CAEPE is a Continuous Deployment platform purpose built for Kubernetes. CAEPE supports both push and pull approaches and fits seamlessly into your existing pipelines to simplify application deployment for Kubernetes.

Download the PDF version of this kubectl cheat sheet

Check out these other resources:

Scroll to Top