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 basics

Everyday kubectl

WhatHow
Apply a manifestkubectl apply -f app.yaml
List Podskubectl get pods -o wide
Details and eventskubectl describe pod <name>
Logskubectl logs <pod> -f
Logs of a crashed containerkubectl logs <pod> --previous
Shell in a containerkubectl exec -it <pod> -- sh
Reach a Service locallykubectl port-forward svc/api 8080:80
Another namespacekubectl get pods -n <namespace>

Rollout

WhatHow
Rollout statuskubectl rollout status deployment/api
Historykubectl rollout history deployment/api
Rollbackkubectl rollout undo deployment/api
Restart Podskubectl rollout restart deployment/api
Scalekubectl scale deployment/api --replicas=5

Object map

WhatHow
Podcontainers sharing a network
Deploymentreplicas, rolling update, rollback
ReplicaSetkeeps the requested number of Pods
Servicestable name and load balancing
IngressHTTP routes: host and path
ConfigMapsettings
Secretsensitive data (base64, not encryption)
HPAautoscales replicas

Probes and resources

WhatHow
readiness failedPod gets no traffic
liveness failedcontainer restart
startupwaits for startup, then the other probes run
requestsguaranteed, used for scheduling
limit CPUthrottling
memory limitOOMKilled, exit code 137

Other cheat sheets