← Cheatsheets
Kubernetes
kubectl
Essential kubectl commands for managing Kubernetes clusters, workloads and resources.
Cluster & Context
kubectl cluster-infokubectl config get-contextskubectl config current-contextkubectl config use-context <name>kubectl get nodeskubectl get nodes -o widePods
kubectl get podskubectl get pods -n <namespace>kubectl get pods -Akubectl get pods -o widekubectl describe pod <name>kubectl logs <pod>kubectl logs <pod> -fkubectl logs <pod> --previouskubectl exec -it <pod> -- bashkubectl delete pod <name>Deployments
kubectl get deploymentskubectl describe deployment <name>kubectl apply -f <file>.yamlkubectl delete -f <file>.yamlkubectl scale deployment <name> --replicas=3kubectl rollout status deployment/<name>kubectl rollout undo deployment/<name>kubectl rollout history deployment/<name>kubectl set image deployment/<name> app=image:tagServices & Networking
kubectl get serviceskubectl get svc -Akubectl describe service <name>kubectl port-forward <pod> 8080:80kubectl port-forward svc/<name> 8080:80kubectl get ingressNamespaces & Config
kubectl get namespaceskubectl create namespace <name>kubectl get configmapskubectl get secretskubectl get pvckubectl top podskubectl top nodesDebugging
kubectl get events --sort-by=.lastTimestampkubectl run debug --image=busybox --rm -it -- shkubectl cp <pod>:/path/to/file ./localkubectl explain pod.speckubectl api-resources