Diagnosing AKS container restarts caused by probe failures

AI-200 By islever Editorial Last updated

Implement container-orchestrated solutions Monitor and troubleshoot Azure solutions

Short answer

D Inspect the pod events and container logs first to identify why AKS liveness probes fail and the container restarts, before scaling replicas, changing probe timing, or rebooting the node.

Question

A container in an AKS cluster repeatedly restarts. Pod events show probe failures, although node-level CPU and memory metrics are normal. You need to diagnose the cause of the repeating restarts. What should you do first?
  1. Scale the deployment to more replicas.
  2. Decrease the initialDelaySeconds for the container liveness probe.
  3. Drain and reboot the node hosting the pod.
  4. Inspect the pod events and container logs. Correct Answer

Key Takeaways

AKS container restarts caused by probe failures are a pod-level diagnostic problem, not a node-capacity problem. The correct first action is to inspect pod events and container logs, because they reveal probe error messages and container exit details that node CPU and memory metrics cannot show. Scaling replicas, shortening initialDelaySeconds, or rebooting the node acts without evidence and can worsen the outage.

Expert Analysis

Normal node-level CPU and memory readings alongside probe-failure events point to a pod-scoped fault, so the first move is to read pod events and container logs (D) before touching replicas, probe timing, or the node.

Node-capacity metrics and pod-lifecycle signals diverge in AKS diagnostics

In AKS, node-level CPU and memory metrics describe the health and spare capacity of the underlying virtual machine, while pod events describe what the kubelet is doing to an individual container. A node can report 30 percent CPU and ample free memory and still host a container whose liveness probe times out, whose process exits with code 1, or whose readiness endpoint returns HTTP 500. The boundary is therefore not “healthy node versus unhealthy application” in general; it is aggregate infrastructure capacity versus per-pod lifecycle state. Node metrics are sampled and averaged across every pod on the node, so one container in a crash loop is usually invisible there unless it consumes enough resources to move the aggregate. Probe failures, by contrast, are emitted as pod events scoped to one pod and one container. Treating normal node utilization as proof that the container is healthy inverts the evidence: it only proves the node has capacity. In the AKS incident, the restart loop is already visible at the pod level through events, so the diagnostic question is which container-level condition is failing, not whether the node is short of CPU or memory.

Probe-failure events with normal node utilization localize the fault to the container

The deciding condition is the pairing of probe-failure events with normal node CPU and memory: together they rule out node capacity pressure as the immediate cause and localize the failure to the probe execution path or the container process. That localization matters because probe failures have several distinct causes — an HTTP path that returns 500, a TCP port not yet listening, a command that exits non-zero, a timeout shorter than the application's response time, or a container killed before the probe succeeds. Pod events identify the probe type and failure message, such as a connection refused or a timeout, while container logs show whether the process started, crashed, or was killed. Without those two records, any correction is a guess. Inspecting pod events and container logs is therefore the first action because it produces the specific evidence needed to choose the next action, not because it is a generic troubleshooting habit. If the logs show an application exception during startup, the probe timing may be irrelevant; if events show an OOMKill and the last state has exit code 137, memory limits become the target. The correct first step is the one that discriminates among these causes.

Replica scaling, probe-timing edits, and node reboots each act without evidence

Scaling the deployment to more replicas (A) multiplies the failing pod template across additional pods, increases restart churn, and can spread an unready image or configuration through the workload without revealing why the original container failed. Decreasing initialDelaySeconds for the liveness probe (B) makes the kubelet begin probing sooner, which can turn a slow-starting application into an even faster restart loop and changes a probe setting before the event message has shown whether the failure is a timeout, a refused connection, or a non-zero command exit. Draining and rebooting the node (C) is the most disruptive response available here: it evicts healthy pods, interrupts other workloads, and consumes a maintenance window while the node's CPU and memory metrics already show no capacity fault, so the same pod-level condition will usually recur on the replacement node. Each of those actions treats a different suspected layer — capacity, probe timing, or node health — while the observed evidence points only to the pod and its container. They also destroy or obscure the state that a first diagnostic pass needs, because a rescheduled pod loses its previous container instance and local logs. Reading events and logs first preserves that evidence and avoids an unnecessary outage.

Kubernetes probe semantics and kubectl evidence make log inspection the required first step

Kubernetes probe semantics explain why the evidence must come before configuration changes. A liveness probe failure causes the kubelet to restart the container according to the pod's restart policy; a readiness probe failure only removes the pod from service endpoints and does not itself force a restart. The event stream from kubectl describe pod shows which probe failed, the failure message, and the container's last termination reason and exit code. Container logs, especially kubectl logs --previous for a restarted container, show the application output from the instance that died. Exit code 137, for example, indicates the process was killed by SIGKILL and often points to an OOMKill or a liveness-driven termination, while exit code 1 usually indicates an application error. Those signals let an operator distinguish a probe misconfiguration from an application crash before editing initialDelaySeconds or restarting infrastructure. Azure's AKS diagnostics and Container Insights surface the same pod events and container logs, but the Kubernetes primitives remain the first place to look because they retain the per-container last state. In the restart loop described, that sequence — describe the pod, read events, then read current and previous logs — is the documented troubleshooting order and the only step that yields a cause-specific next action.

Official Reference

Exam Strategy

When an AKS pod restarts while node CPU and memory are normal, treat the node metrics as cleared and look for the narrowest evidence source: kubectl describe pod for probe events, then current and previous container logs. Do not change probe timing, replica count, or node state until the event message tells you whether the failure is a timeout, refused connection, OOMKill, or application exit. On exam items, a change that acts on a layer the evidence has not implicated is almost always a distractor.

Practice All AI-200 Questions

Access 69 questions with complete answers and detailed explanations.

View Full AI-200 Practice Test →

← Back to AI-200 Study Guide