Kubernetes: Debug: describe, events, logs
8 Kubernetes commands: Debug: describe, events, logs. Click a command to see what each part does.
Kubernetes: Debug: describe, events, logsIndex
- Whole sheet137
- Basics: cluster, namespaces & resources17
- Get & list resources23
- Context & namespace3
- Find resources9
- Debug: describe, events, logs8
- Exec, port-forward, copy4
- Deploy, roll out, roll back, scale7
- Cleanup & nodes4
- Services, DNS & networking checks6
- Environment, config & secrets of workloads9
- Create, generate & apply YAML10
- Patch, label, annotate & scale9
- Delete & force delete6
- Nodes, scheduling & access control11
- Productivity: aliases, contexts & output11
Debug: describe, events, logs8
kubectl describe pod <pod> -n <namespace>Why is a pod not starting?What each part does
describe pod <pod>status, conditions, container states (Last State / Exit Code) and events at the bottom-n <namespace>namespace of the pod
Tip Look for ImagePullBackOff, FailedScheduling, OOMKilled, probe failures in Events.
kubectl get events -n <namespace> --sort-by=.metadata.creationTimestampRecent events, newest lastWhat each part does
get eventscluster events (scheduling, pulls, kills, probe failures)--sort-by=.metadata.creationTimestampoldest → newest
kubectl events -n <namespace> --types=WarningOnly warning eventsWhat each part does
kubectl eventsnewer events subcommand--types=Warningonly Warning-type events
kubectl logs -f <pod> -n <namespace> --tail=200Follow logs of a podWhat each part does
logs <pod>container's stdout/stderr-fstream new lines--tail=200start from the last 200 lines
kubectl logs <pod> -c <container> --previousLogs of the crashed (previous) containerWhat each part does
-c <container>pick a container in a multi-container pod--previouslogs of the previous instance, i.e. the one that crashed
kubectl logs -l app=<app> --all-containers --prefix -fLogs from all pods with a labelWhat each part does
-l app=<app>every pod matching the label--all-containersall containers in each pod--prefixprefix lines with pod/container name-ffollow
kubectl logs deploy/<deployment> --since=1h | grep -i errorGrep logs for errorsWhat each part does
deploy/<deployment>logs from one pod of the deployment--since=1honly the last hour| grep -i errorkeep lines with "error", any case
kubectl top pod -n <namespace> --sort-by=memory --containersCPU / memory usageWhat each part does
top podlive usage (needs metrics-server)--sort-by=memoryhighest memory first (or cpu)--containersper container instead of per pod
Nothing matches.
My DevOps Playbook by Angelo John Calleja