Find problems with events, logs and metrics

DevOps, Hands On30 minutesFreeSteps checked 23 November 2026By Cloud Hands On

In this task you'll find out what's wrong in a cluster quickly, from the signals it already gives you.

Kubernetes already tells you a lot. Events record what the control plane did and why it failed (scheduling, pulling, probes, evictions) and last about an hour. Logs come from each container's output, with --previous for the run before the current one (while a crashed pod waits to restart, plain logs already shows the crash). metrics-server gives current CPU and memory for kubectl top, which is also what the autoscaler reads.

For history and alerts you add a metrics system (such as Prometheus and Grafana, or Azure Monitor managed Prometheus) and a log store. A good first pass during an incident: events sorted by time, then the failing pod's describe and previous logs, then top for pressure.

Example. Quayhurst Health's on-call checklist starts with kubectl get events -A --sort-by=.lastTimestamp | tail -30. During one incident it showed FailedScheduling for every new pod within seconds, which led straight to a node pool that had hit its quota.

Before you start

You need: Docker Desktop, kind and kubectl on your computer (all free), and a cluster from Run a practice cluster on your computer, plus metrics-server (free). Time: 30 minutes.

Where to look

  1. Terminal
  2. kubectl
  3. Helm

Steps

  1. Install metrics-server (on kind, add the --kubelet-insecure-tls argument) and wait for kubectl top nodes to show numbers.
  2. Show recent events across the cluster sorted by time.
  3. Start a pod with a wrong image tag and find it in the events within a minute.
  4. Start a pod that crashes after printing a message, and read the message with kubectl logs crasher; add --previous once it has restarted and is running again.
  5. Find the pod using the most memory with kubectl top pods -A --sort-by=memory.

Commands

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
kubectl get events -A --sort-by=.lastTimestamp | tail -30
kubectl logs <pod> --previous
kubectl top pods -A --sort-by=memory | head

Watch out for

Cost
Free on kind. Hosted metrics and logs are charged by volume: keep only what you use.
Security
Logs can contain personal data and secrets; control who can read them and how long they're kept.
Common mistakes
Looking only at current logs of a restarted container, and forgetting events expire after about an hour.

Clean up

Delete the test pods; keep metrics-server for later tasks.

Words to know

Event
A short record of something the cluster did or failed to do.
metrics-server
A cluster add-on that collects current CPU and memory use.
kubectl top
Shows current CPU and memory for nodes or pods.
Prometheus
A popular system that collects and stores metrics over time.

Tick off each step and track your progress in the guide.

Open this task in DevOps, Hands On

Keep going