A quick reference for the most commonly used kubectl commands covering pods, deployments, services,
Stop memorizing every flag! I've put together a handy kubectl cheat sheet for managing pods, deployments, and debugging. Originally published on devopsstart.com.
Pod Management
Command
Description
kubectl get pods
List all pods in current namespace
kubectl get pods -A
List pods across all namespaces
kubectl describe pod <name>
Show detailed pod information
kubectl delete pod <name>
Delete a specific pod
kubectl logs <pod>
View pod logs
kubectl logs <pod> -f
Stream pod logs
kubectl exec -it <pod> -- sh
Open shell in pod
Deployments
Command
Description
kubectl get deployments
List all deployments
kubectl scale deploy <name> --replicas=3
Scale a deployment
kubectl rollout status deploy/<name>
Check rollout status
kubectl rollout undo deploy/<name>
Rollback a deployment
kubectl set image deploy/<name> <container>=<image>
Update container image
Services and Networking
Command
Description
kubectl get svc
List all services
kubectl get ingress
List all ingress resources
kubectl port-forward svc/<name> 8080:80
Forward local port to service
kubectl get endpoints
List service endpoints
Debugging
Command
Description
kubectl get events --sort-by=.metadata.creationTimestamp