CHEATSHEET • KUBERNETES & HELM

Kubernetes (kubectl) & Helm Cheatsheet

Quick-copy CLI commands for cluster inspection, pod debugging, deployment rollouts, networking, and Helm chart management.

01Cluster, Pods & Live Debugging

Display cluster control-plane endpoints and list all nodes
kubectl cluster-info && kubectl get nodes -o wide
List all pods across every namespace with node & IP details
kubectl get pods -A -o wide
Stream live logs from a pod (or previous crashed container)
kubectl logs -f <pod-name> --tail=100
Open an interactive shell inside a running container
kubectl exec -it <pod-name> -- /bin/sh
Inspect recent cluster warning/error events sorted by time
kubectl get events --sort-by=.metadata.creationTimestamp
View live CPU and memory usage for pods and nodes
kubectl top pods -A && kubectl top nodes

02Deployments, Rollouts & Scaling

Apply or update resources from a YAML manifest file
kubectl apply -f deployment.yaml
Watch rollout progress until all replicas are updated
kubectl rollout status deployment/<name>
Immediately roll back a deployment to the previous revision
kubectl rollout undo deployment/<name>
Trigger a zero-downtime rolling restart of a deployment
kubectl rollout restart deployment/<name>
Configure Horizontal Pod Autoscaler (HPA) based on CPU
kubectl autoscale deployment/<name> --cpu-percent=50 --min=2 --max=10
Advertisement

03Services, Port-Forwarding & Config

Forward a local port to a ClusterIP Service for quick testing
kubectl port-forward svc/<service-name> 8080:80
Inspect services, endpoints, and ingress routing rules
kubectl get svc,ep,ingress -o wide
Create an Opaque Secret from literal key-value pairs
kubectl create secret generic app-secret --from-literal=API_KEY=changeme
List PersistentVolumes and PersistentVolumeClaims
kubectl get pv,pvc

04Helm Chart Lifecycle & Debugging

Add a Helm repository, refresh indexes, and search charts
helm repo add bitnami https://charts.bitnami.com/bitnami && helm repo update
Install a Helm chart release with custom values
helm install my-release bitnami/nginx -f values.yaml
Upgrade an existing release (or install if missing) with auto-rollback
helm upgrade --install my-release ./my-chart --atomic
Lint chart syntax and render templates without deploying
helm lint ./my-chart && helm install --debug --dry-run test ./my-chart
List active releases or roll back a release to revision 1
helm list -A && helm rollback my-release 1
Copied to clipboard!