late::binding

kubectl commands I keep forgetting

· #kubernetes

Logs of the container that crashed, not the one that just started:

kubectl logs my-pod --previous

What happened in the namespace, in order:

kubectl get events --sort-by=.lastTimestamp

Restart a deployment without changing its manifest:

kubectl rollout restart deployment/my-app
kubectl rollout status deployment/my-app

Go back to the previous revision:

kubectl rollout undo deployment/my-app

Reach a service from the laptop:

kubectl port-forward svc/my-app 8080:80

A shell next to a container that has no shell of its own:

kubectl debug -it my-pod --image=busybox --target=my-app

Who is using the memory:

kubectl top pods --sort-by=memory

Which image is really running:

kubectl get pod my-pod -o jsonpath='{.spec.containers[*].image}'
← all notes