Complete kubectl commands cheat sheet for Kubernetes cluster management. Covers pod operations, deployments, services, contexts, and namespace management.
Search all Kubernetes (kubectl) shortcuts interactively
Interactive Shortcut Finder| Shortcut | Action | Description |
|---|---|---|
| kubectl get pods | List pods | List pods in current namespace. |
| kubectl get svc | List services | List services. |
| kubectl get nodes | List nodes | List cluster nodes. |
| kubectl get all | All resources | List all resources. |
| kubectl describe pod [name] | Pod details | Show detailed pod information. |
| kubectl logs [pod] | View logs | View pod logs. |
| kubectl logs -f [pod] | Follow logs | Follow pod logs in real time. |
| Shortcut | Action | Description |
|---|---|---|
| kubectl apply -f [file] | Apply resource | Create/update resources from YAML. |
| kubectl delete pod [name] | Delete pod | Delete a pod. |
| kubectl scale deploy [name] --replicas=3 | Scale | Change deployment replica count. |
| kubectl exec -it [pod] -- bash | Enter pod | Open bash shell inside a pod. |
| kubectl port-forward [pod] 8080:80 | Port forward | Forward local port to pod port. |
| kubectl rollout restart deploy [name] | Rolling restart | Rolling restart a deployment. |
| Shortcut | Action | Description |
|---|---|---|
| kubectl config get-contexts | List contexts | Show available contexts. |
| kubectl config use-context [name] | Switch context | Switch to another cluster context. |
| kubectl get ns | List namespaces | List namespaces. |
| kubectl -n [NS] get pods | Specify namespace | Query resources in specific namespace. |
Use 'kubectl get pods' for the current namespace, or 'kubectl get pods --all-namespaces' for all namespaces.
Use 'kubectl exec -it pod-name -- /bin/bash' to open an interactive shell.
Use 'kubectl logs pod-name' for logs, add '-f' to follow, or '--previous' for logs from a crashed container.
Use 'kubectl scale deployment name --replicas=3' to change the number of pod replicas.
Kubernetes (kubectl) includes 7 View Resources shortcuts, including kubectl get pods (List pods) and kubectl get svc (List services). See the full list in the View Resources section above.
Kubernetes (kubectl) includes 6 Manage Resources shortcuts, including kubectl apply -f [file] (Apply resource) and kubectl delete pod [name] (Delete pod). See the full list in the Manage Resources section above.
Yes — use My Stack to combine Kubernetes (kubectl) shortcuts with any other platform on this site into one printable reference, which is useful if your daily workflow spans several tools.
Browse shortcuts for 269 platforms
Explore AllOpen your assistant with this page preloaded as the source — great for follow-up questions like "which of these work in other apps?"