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.
Cluster
kubectl version
kubectl cluster-info
kubectl config view
kubectl config get-contexts
kubectl config current-context
kubectl config use-context [cluster_context_name]
kubectl api-versions
kubectl api-resources
Logs
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]
Resources
kubectl top node
kubectl top pod
kubectl cordon node [node_name]
kubectl uncordon node [node_name]
kubectl drain node [node_name]
Events
kubectl get events
kubectl get events --field-selector type=Warning
CAEPE Continuous Deployment
Manage workloads on Kubernetes anywhere robustly and securely.
- Shores up security by simplifying deployment anywhere, supporting managed services, native Kubernetes, self-hosted, edge and secure airgapped deployment targets.
- Supports GitOps and provides guided, UI-driven workflows for all major progressive delivery strategies.
- Has RBAC built-in, providing inherent enterprise access control for who can deploy.
- Supports extended testing capabilities enabling your team to run different tests quickly and easily.