How to use the kubectl Cheat Sheet
- 1. Search or browseType what you want to do, or pick one section of the kubectl cheat sheet.
- 2. CopyEvery entry has its own Copy button, so it goes straight into your editor or notes.
- 3. DownloadSave the whole kubectl cheat sheet as plain text or Markdown for offline revision.
What's in it
Commands work on any conformant Kubernetes cluster, including minikube, kind, EKS, AKS and GKE. The 40 commands are organised into 7 sections: Context & config, Viewing, Creating & applying, Deployments, Debugging, Config & secrets, Nodes & namespaces.
Example
A pod is stuck in CrashLoopBackOff. Run kubectl describe pod web-1 and read the Events at the bottom; they often show a bad image name or a failed probe. Then kubectl logs web-1 --previous shows what the container printed before it crashed. Fixed the config? kubectl rollout restart deployment/web brings up fresh pods, and kubectl rollout status deployment/web waits until they are ready.
Tips for using it
- Add
-n <namespace>to any command, or set a default namespace once with set-context. - Generate YAML with --dry-run=client -o yaml instead of writing manifests from memory.
- Secrets are only base64-encoded unless your cluster enables encryption at rest; treat access to them carefully.
A quick look, one entry per section
- Context & config:
kubectl config get-contexts(list clusters and users you can switch between) - Viewing:
kubectl get pods(pods in the current namespace) - Creating & applying:
kubectl apply -f deployment.yaml(create or update resources from a file (declarative)) - Deployments:
kubectl scale deployment web --replicas=5(change the number of pods) - Debugging:
kubectl logs web-1(logs of a pod) - Config & secrets:
kubectl create configmap app-cfg --from-file=config.json(configMap from a file) - Nodes & namespaces:
kubectl get nodes(list nodes and their status)
Search the box above for the rest of the kubectl entries, or download the full sheet.
Frequently asked questions
Do I need a cluster to practise?
A local cluster with minikube or kind is enough for every command here.
What does kubectl top need?
The metrics-server add-on. Many managed clusters include it; on minikube enable it with minikube addons enable metrics-server.
Is the kubectl cheat sheet free?
Yes. You can search, read and copy every entry in the kubectl cheat sheet without signing up. The first time you download it, we ask once for your name and WhatsApp number; after that downloads and every other Uncodemy tool open straight away.