Kubernetes Cheat Sheet

Key kubectl commands, resource definitions, and cluster management operations. Complete reference guide with copy-paste ready commands.

Cluster Info

kubectl cluster-info

Display cluster information

kubectl get nodes

List all nodes in the cluster

kubectl get namespaces

List all namespaces

kubectl config get-contexts

List available contexts

Pod Management

kubectl get pods

List pods in current namespace

kubectl get pods -A

List pods in all namespaces

kubectl describe pod <pod>

Show details of a pod

kubectl logs <pod>

Print container logs

kubectl exec -it <pod> -- bash

Execute command in pod

kubectl delete pod <pod>

Delete a pod

Deployments & Services

kubectl get deployments

List all deployments

kubectl get services

List all services

kubectl apply -f <file>.yaml

Apply a configuration file

kubectl scale deployment <name> --replicas=3

Scale a deployment

kubectl rollout status deployment/<name>

Check rollout status