Previous crash logs with timestamps
Tail the crashed container's prior instance logs to catch the pre-restart stack trace
kubectl logs <pod> -n <ns> -c <name> --previous --timestamps --tail=200
- tool
- k8s-debug27 commands
More k8s-debug commands
-
kubectl debug -it <pod> --image=nicolaka/netshoot -n <ns>Attach a debug container (netshoot) to a running pod — shares PID/net namespaces
-
kubectl top nodesCPU and memory per node (requires metrics-server)
-
kubectl top pods -A --sort-by=memoryMemory-sorted pod usage across all namespaces — find the hungry ones
-
kubectl get cm <name> -n <ns> -o jsonpath='{.data}'Print just the data field; pipe to python -m json.tool for formatting
-
kubectl get secret <name> -n <ns> -o jsonpath='{.data}' | python3 -c "import sys,json,base64; [print(k,'=',base64.b64decode(v).decode()) for k,v in json.load(sys.stdin).items()]"Dump and base64-decode all fields in a k8s Secret