Troubleshoot AKS and Container Apps: Logs, Events, Connectivity
30-second answer
When a container app breaks, check three places. Logs show what your app said: kubectl logs (add --previous for a crashed container) on AKS, az containerapp logs show --type console on Container Apps. Events show what the platform did: kubectl describe pod and kubectl get events on AKS, --type system logs on Container Apps. Connectivity checks (Service endpoints, ports, DNS, ingress) show whether traffic can reach the app. In Log Analytics, Container Apps logs land in ContainerAppConsoleLogs_CL and ContainerAppSystemLogs_CL.
Exam objective: 1.2.4 Monitor and troubleshoot solutions on AKS and Container Apps by inspecting logs, events, and end-to-end connectivity. (Skills measured as of October 7, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
You deployed v3 and the URL still serves the old version. Start at <strong>Revisions and replicas</strong>.
👆 Click the glowing item in the portal to continue
Read the steps as text
- You deployed v3 and the URL still serves the old version. Start at Revisions and replicas.
- v3 failed to activate. The revision status tells you that it broke; the logs tell you why.
- System logs come from the platform: image pulls, probes, restarts. Here the ingress target port is 8080 but the app listens on 8000.
- Console logs are your app’s stdout and stderr. A second problem: v3 lost the AZURE_OPENAI_ENDPOINT variable.
- The live stream is gone after a restart. Logs keeps the history in Log Analytics, so you can query it later.
- Diagnose and solve problems runs the common checks for you. Fix the port and the variable, then deploy again.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
Troubleshoot: logs, events, connectivity
When it breaks, look in three places. Logs (kubectl logs, az containerapp logs show) show what the app said. Events (kubectl describe, kubectl get events) show what the platform did. Connectivity checks (DNS, ports, ingress) show whether traffic can reach it.
🤔 What happens if…
Read this tour as text
- Build an image, push it to the registry. Your Python API and everything it needs are packed into a container image. You push it to Azure Container Registry (ACR) as
ragapi:1.4.0. A tag names a version. A digest (sha256:…) names the exact bytes and never changes. - ACR Tasks build in the cloud. ACR Tasks build the image inside Azure, so you don’t need Docker on your laptop.
az acr buildis a quick task. A task can also run on every git commit or when the base image (saypython:3.12-slim) gets a security patch. - App Service runs one container. App Service pulls the image and runs it. App settings become environment variables inside the container. A setting can be a Key Vault reference, so the secret never sits in the image or in the portal in plain text.
- Container Apps environment. An Azure Container Apps environment is a secure boundary with its own virtual network and Log Analytics workspace. Several container apps share it. Ingress decides who can reach each app: external (internet) or internal (only the environment).
- Revisions and traffic splitting. Every change to the template (image, env vars, scale rules) creates a new revision, an immutable snapshot. In multiple revision mode you can send 80% of traffic to the old one and 20% to the new one, then roll forward or back.
- KEDA scales on events. Container Apps uses KEDA scale rules. A Service Bus rule adds replicas as the queue grows (for example one replica per 5 messages), up to max replicas. When the queue empties, it scales back to min replicas, which can be zero.
- AKS runs what the manifest says. On AKS you describe the app in YAML manifests: a Deployment (image, replicas, probes, resources) and a Service (a stable address).
kubectl apply -fsends them. Kubernetes keeps the real state equal to what you declared. - Troubleshoot: logs, events, connectivity. When it breaks, look in three places. Logs (
kubectl logs,az containerapp logs show) show what the app said. Events (kubectl describe,kubectl get events) show what the platform did. Connectivity checks (DNS, ports, ingress) show whether traffic can reach it.
Deploy a small API to Kubernetes with manifests, watch it heal itself, then hit the two failures every developer meets: an image that doesn't exist and a container that crashes on start. Use describe, logs and rollout to fix them.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
The app is “down” and nobody knows where to start.
😊 THE SOLUTION
Check logs, then events, then connectivity, in that order.
- CrashLoopBackOff✓ kubectl logs --previous
- ImagePullBackOff✓ kubectl describe pod events
- Can’t reach the database✓ Test DNS and ports from inside
Start with a question
The app says it's deployed. So why does every request time out?
Maybe the container keeps crashing. Maybe it never started because the image name has a typo. Maybe it’s running fine but listening on the wrong port, so nothing reaches it. Each of those looks the same from the outside: no answer.
The trick is to look in the right place. Logs tell you what the app said, events tell you what the platform did, and connectivity checks tell you whether traffic can get there.
Explain it like I’m 10
The technical explanation
Read the status first
| What you see | It usually means | Look at |
|---|---|---|
ImagePullBackOff / ErrImagePull | Wrong image name or tag, or no pull permission | kubectl describe pod, az aks check-acr |
CrashLoopBackOff | The app starts and exits (missing env var, bad config, exception) | kubectl logs <pod> --previous |
Pending | No node has room for the pod’s requests, or a volume can’t attach | Events: FailedScheduling |
OOMKilled | The container went over its memory limit | kubectl describe pod (Last State), raise the limit |
Running but 0/1 READY | The readiness probe fails | Events: Unhealthy, check probe path and port |
AKS: logs and events
kubectl get pods # status column first
kubectl describe pod ragapi-7d9f8c6b5-x2k4q # Events at the bottom
kubectl get events --sort-by=.metadata.creationTimestamp
kubectl logs ragapi-7d9f8c6b5-x2k4q # current container
kubectl logs ragapi-7d9f8c6b5-x2k4q --previous # the one that crashed
kubectl logs deployment/ragapi -f # follow one pod of the Deployment
az aks check-acr -g rg-ai -n aks-rag --acr myreg.azurecr.io # can nodes pull?
AKS: connectivity
kubectl get endpoints ragapi # empty = selector matches no ready pods
kubectl port-forward deployment/ragapi 8000:8000 # bypass the Service, test the pod
kubectl run tmp --rm -it --image=busybox -- wget -qO- http://ragapi/healthz # DNS + Service from inside
kubectl exec -it deployment/ragapi -- sh # check env vars and outbound access
With Container insights turned on, logs and events also go to Log Analytics (ContainerLogV2, KubeEvents, KubePodInventory), so you can query history after the pod is gone.
Container Apps: system and console logs
az containerapp logs show -g rg-ai -n ragapi --type system --follow # platform: pulls, probes, revision state
az containerapp logs show -g rg-ai -n ragapi --type console --follow # your app's stdout and stderr
az containerapp revision list -g rg-ai -n ragapi -o table # health and running state per revision
az containerapp exec -g rg-ai -n ragapi --command sh # shell inside a replica
The same logs are in the environment’s Log Analytics workspace:
ContainerAppConsoleLogs_CL
| where ContainerAppName_s == "ragapi"
| where Log_s contains "Error"
| project TimeGenerated, RevisionName_s, Log_s
| order by TimeGenerated desc
ContainerAppSystemLogs_CL
| where ContainerAppName_s == "ragapi" and Reason_s != ""
| project TimeGenerated, RevisionName_s, Reason_s, Log_s
Common Container Apps causes: target port doesn’t match what the container listens on, ingress is internal when callers are outside, the registry identity has no AcrPull, a secret was changed but the revision wasn’t restarted, or a health probe points at the wrong path. The portal’s Diagnose and solve problems page checks many of these for you.
-
1 Status
kubectl get pods or revision list: what state is it in?
-
2 Events
describe / get events / --type system: what did the platform do?
-
3 Logs
logs --previous / --type console: what did the app say?
-
4 Path
endpoints, ports, DNS, ingress: can traffic get there?
Architect level Make the app easy to troubleshoot
Log to stdout and stderr, not to files inside the container, so both platforms collect it. Add a /healthz endpoint that checks only what the app needs to serve (not every downstream dependency, or one slow database fails every probe and the platform restarts healthy pods). Fail fast with a clear message when a required environment variable is missing, so --previous shows “SEARCH_KEY is not set” instead of a stack trace three calls deep. And send traces to Application Insights with OpenTelemetry so a timeout can be followed across services.
Real-world business scenario
Tailwind Traders (fictional)
- The problem
- After a release, the product-question API on AKS returned 502s. The team spent an hour reading application logs that were empty, because the new pods never got ready.
- What they used
- A runbook: kubectl get pods, kubectl describe pod for events, kubectl logs --previous, then kubectl get endpoints. Container insights sends ContainerLogV2 and KubeEvents to Log Analytics for history.
- Why that choice
- The events showed the readiness probe failing on /health while the new build served /healthz, which no application log would have shown.
- The result
- The probe path was fixed in the manifest in minutes, and the runbook now starts with events, not logs.
When to use it and when not to
✓ Use it when…
- kubectl describe and events when a pod is Pending, pulling or being killed.
- kubectl logs --previous or Container Apps console logs when the app crashes.
- Log Analytics queries when you need history after pods or replicas are gone.
✕ Think twice when…
- Reading only application logs when the container never started.
- Restarting pods over and over before reading why they failed.
↔ Alternatives to consider
- Application Insights with OpenTelemetry for request-level traces across services.
- Diagnose and solve problems in the portal for guided checks on Container Apps and AKS.
Test yourself with exercises
5 original practice questions in the AI-200 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner A pod shows CrashLoopBackOff. What's your first command?
Model answer
kubectl logs on that pod with --previous, because the current container may have only just started and have nothing useful yet. The previous container's output usually shows the stack trace, like a missing environment variable.
Intermediate What's the difference between logs and events?
Model answer
Logs are what my application printed. Events are what Kubernetes did: scheduled the pod, pulled the image, killed it for failing a liveness probe, couldn't find room on a node. If the app never started, there are no logs, so events are where I look.
Experienced developer A Container Apps revision is stuck in a failed provisioning state. How do you find out why?
Model answer
az containerapp logs show with --type system shows the platform side: image pull errors, probe failures, the container exiting. I'd also check az containerapp revision list for the health state and, for history, query ContainerAppSystemLogs_CL in Log Analytics filtered by RevisionName_s.
Interviewer follows up
And if the system logs look fine?
You
Then the app itself is failing, so I read --type console, or ContainerAppConsoleLogs_CL, for its own output.
Scenario Pods are Running and Ready but the Service returns nothing. What do you check?
Model answer
kubectl get endpoints for the Service. If it's empty, the selector doesn't match the pod labels. If it has IPs, I check targetPort against the containerPort, then test from inside the cluster with a temporary pod and curl the Service name.
Quick revision
Key points
- Logs (what the app said), events (what the platform did), connectivity (can traffic reach it).
- kubectl logs --previous reads the last crashed container; kubectl describe pod shows its events.
- ImagePullBackOff = wrong image or no AcrPull; check with az aks check-acr.
- Container Apps --type system is platform logs, --type console is your app's output.
- Log Analytics tables are ContainerAppConsoleLogs_CL and ContainerAppSystemLogs_CL; AKS container logs go to ContainerLogV2.
Important terminology
- CrashLoopBackOff
- A pod status meaning the container keeps starting and crashing, and Kubernetes is waiting longer between restarts.
- ImagePullBackOff
- A pod status meaning the node can't pull the image, usually a wrong name or tag or missing pull permission.
- Events
- Kubernetes records of what the platform did to an object, such as scheduling, pulling, probe failures and kills.
- System logs (Container Apps)
- Platform messages about revisions, replicas, image pulls and probes, stored in ContainerAppSystemLogs_CL.
- Console logs (Container Apps)
- Your container's stdout and stderr, stored in ContainerAppConsoleLogs_CL.
- Endpoints
- The list of pod IPs a Kubernetes Service currently forwards to; empty means no ready pods match.
Common mistakes
- Running kubectl logs on a CrashLoopBackOff pod without --previous and seeing nothing useful.
- Looking for application logs when the container never started; check events or system logs first.
Exam tips
- "Why can't the pod start or pull its image?" = kubectl describe pod / kubectl get events.
- "See output from the container that just crashed" = kubectl logs --previous.
- "Query Container Apps app output in Log Analytics" = ContainerAppConsoleLogs_CL.
Five quick revision questions
-
1.Which kubectl flag shows logs from the previous container instance?Show
--previous
-
2.Which command shows a pod's events?Show
kubectl describe pod
-
3.Which Container Apps log type shows platform messages?Show
system
-
4.Which table holds Container Apps console output?Show
ContainerAppConsoleLogs_CL
-
5.What does an empty Service endpoints list usually mean?Show
The Service selector doesn't match any ready pod.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Embeddings and Vector Search for Developers
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.