One page
Kubernetes cheat sheet
What to keep at hand. If a line is not clear, go back to the matching lesson in the course.
Open the course: Kubernetes: the basicsEveryday kubectl
| What | How |
|---|---|
| Apply a manifest | kubectl apply -f app.yaml |
| List Pods | kubectl get pods -o wide |
| Details and events | kubectl describe pod <name> |
| Logs | kubectl logs <pod> -f |
| Logs of a crashed container | kubectl logs <pod> --previous |
| Shell in a container | kubectl exec -it <pod> -- sh |
| Reach a Service locally | kubectl port-forward svc/api 8080:80 |
| Another namespace | kubectl get pods -n <namespace> |
Rollout
| What | How |
|---|---|
| Rollout status | kubectl rollout status deployment/api |
| History | kubectl rollout history deployment/api |
| Rollback | kubectl rollout undo deployment/api |
| Restart Pods | kubectl rollout restart deployment/api |
| Scale | kubectl scale deployment/api --replicas=5 |
Object map
| What | How |
|---|---|
| Pod | containers sharing a network |
| Deployment | replicas, rolling update, rollback |
| ReplicaSet | keeps the requested number of Pods |
| Service | stable name and load balancing |
| Ingress | HTTP routes: host and path |
| ConfigMap | settings |
| Secret | sensitive data (base64, not encryption) |
| HPA | autoscales replicas |
Probes and resources
| What | How |
|---|---|
| readiness failed | Pod gets no traffic |
| liveness failed | container restart |
| startup | waits for startup, then the other probes run |
| requests | guaranteed, used for scheduling |
| limit CPU | throttling |
| memory limit | OOMKilled, exit code 137 |