Troubleshooting AKS Workloads
This lesson explains how to read Pod status, find causes with kubectl, test connectivity inside a cluster, and query Container insights.
Learning outcomes
After completing this lesson, you will be able to:
- Interpret common Pod statuses.
- Choose the kubectl command that reveals a cause.
- Describe a systematic connectivity check.
- Identify the Container insights tables.
Reading Pod status
kubectl get pods is the first command in almost every investigation. Its STATUS, READY and RESTARTS columns identify the type of problem before any detailed digging, and each common status has a typical cause.
| Status | Meaning | Typical cause |
|---|---|---|
| Pending | The Pod has not been scheduled to a node | Insufficient CPU or memory for the requests, node selectors or taints that no node satisfies |
| ErrImagePull / ImagePullBackOff | The node cannot pull the image | Wrong image name or tag, or no pull permission on the registry |
| CreateContainerConfigError | The container cannot be configured | A referenced ConfigMap or Secret, or a key within it, does not exist |
| CrashLoopBackOff | The container starts, exits and is restarted with increasing delays | An application error at start-up, a missing setting, or a failing liveness probe |
| OOMKilled (last state) | The container exceeded its memory limit | Limit too low for the workload, or a memory leak |
| Running, READY 0/1 | The container runs but fails its readiness probe | A health endpoint that fails or a dependency that is unreachable |
The RESTARTS count matters too: a Running Pod with many restarts is crashing intermittently, often because of a liveness probe that is too aggressive or memory that grows until the limit is reached.
Pod statuses
Finding the cause with kubectl
Three commands supply most of the detail. kubectl describe pod NAME prints the Pod's configuration and, at the end, its events, which explain scheduling failures, image pull errors, probe failures and kills. kubectl logs NAME prints the container's output, and kubectl logs NAME --previous prints the output of the container instance that crashed, which is essential for CrashLoopBackOff because the current instance may not have logged anything yet. kubectl get events lists recent events across a namespace.
kubectl get pods -n orders -o wide
kubectl describe pod orders-api-6d9f7c9b8-x2kqp -n orders
kubectl logs orders-api-6d9f7c9b8-x2kqp -n orders --previous
kubectl get events -n orders --sort-by=.lastTimestamp
kubectl top pods -n orderskubectl top shows current CPU and memory use from the metrics server, which helps confirm a memory limit problem. For a Deployment that does not progress, kubectl describe deployment and kubectl rollout status show whether it is waiting for readiness or failing to create Pods.
The following diagram shows the troubleshooting sequence for a Pod in CrashLoopBackOff and how to read its exit code.

Which kubectl command?
Testing connectivity inside the cluster
When Pods are healthy but requests fail, the problem is usually in how traffic reaches them or leaves them. A systematic check follows the request path.
-
Check the Service
kubectl get endpoints SERVICEorkubectl get endpointslicesmust list Pod addresses; an empty list means the selector does not match or no Pod is ready. -
Check DNS
From a Pod,
nslookup SERVICE.NAMESPACE.svc.cluster.localshould return the Service IP; failures point to CoreDNS or a wrong name. -
Call the Service
From a temporary Pod, call the Service with curl to separate Service problems from ingress problems.
-
Check the edge
Inspect the Ingress, the ingress controller logs and the load balancer's public IP and rules.
-
Check policies and egress
Network policies, network security groups and firewalls can block traffic between namespaces or to Azure services.
kubectl run netcheck -n orders --rm -it --image=busybox:1.36 -- sh
kubectl port-forward service/orders-api 8080:80 -n orderskubectl run with --rm -it starts a temporary interactive Pod that is deleted on exit; the small busybox image includes nslookup and wget for DNS and HTTP tests. kubectl port-forward forwards a local port to a Service or Pod, which tests the application without involving ingress. kubectl exec runs a command in an existing container when its image includes the needed tools.
Following the request path
Container insights and KQL
kubectl shows the present; for history and for alerting, AKS sends data to Azure Monitor. Container insights collects container logs into the ContainerLogV2 table, Kubernetes inventory and events into tables such as KubePodInventory and KubeEvents, and node and container performance data. Azure Monitor managed service for Prometheus collects metrics, which Azure Managed Grafana can chart.
The following query, run in the cluster's Log Analytics workspace, lists the Pods that restarted most in the last day, which is often the quickest way to find an unstable workload across a large cluster. The KQL module explains the operators.
KubePodInventory
| where TimeGenerated > ago(1d)
| summarize Restarts = max(ContainerRestartCount) by Namespace, Name
| top 10 by RestartsContainer insights tables
CrashLoopBackOff after a configuration change
After a ConfigMap was edited, an API's Pods enter CrashLoopBackOff. kubectl logs shows nothing useful because each new container exits within a second. kubectl describe pod shows Back-off restarting failed container, exit code 1.
Exit code 1 with immediate exits means that the application itself failed at start-up. The output of the previous container instance contains the traceback, so the next command is kubectl logs POD --previous. In this case it shows a KeyError for an environment variable that the ConfigMap edit removed; restoring the key in the ConfigMap and restarting the Deployment with kubectl rollout restart fixes it.
Increasing the memory limit would help only for exit code 137. Deleting the Pods would create new ones with the same configuration. Pulling the image again would not change a configuration error.
A Pod is in CreateContainerConfigError. What should you check first?
Show answer
Whether every ConfigMap and Secret the Pod references, and every key within them, exists in the Pod's namespace. kubectl describe pod shows the missing reference in its events.
Exam Tips
Remember for the exam
- Pending: scheduling; ImagePullBackOff: image name or pull rights; CrashLoopBackOff: the app exits.
- kubectl describe shows events; kubectl logs --previous shows the crashed container's output.
- An empty endpoints list means a selector mismatch or no ready Pods.
- Container insights stores logs in ContainerLogV2 and inventory in KubePodInventory.