Video Thumbnail for Lesson
11.1: Debugging Applications in Kubernetes

Debugging Applications in Kubernetes

In this lesson we'll practice troubleshooting a broken deployment using the microservices demo application from Google. A manifest with several intentional issues is provided in the course repo.

Debugging workflow

  • Start with kubectl get pods to see which pods are failing.
  • Inspect events with kubectl describe pod <name> and view logs with kubectl logs <name>.
  • Tools like K9s offer a terminal UI that streamlines this process.
  • The LearnK8s troubleshooting flowchart is a handy reference when you are unsure what to check next.

Walkthrough

  1. Deploy the sample app
kubectl create namespace debug-demo
kubectl -n debug-demo apply -f microservices-demo.yaml
  1. Fix the Currency Service – pods fail with OOMKilled events. Increase the memory requests/limits:
resources:
  requests:
    memory: 64Mi
  limits:
    memory: 128Mi
  1. Fix the Cart Service – its liveness and readiness probes check port 8080 but the container listens on 7070. Update both probes to use 7070.

  2. Fix the Redis Cart Deployment – the image tag redis:debian does not exist. Change it to a valid tag such as redis:alpine.

  3. Fix the Load Generator – the CPU request of 3000m and limit of 5000m exceed the node capacity. Set them back to 300m and 500m so the pod can be scheduled.

After each update run kubectl apply -f microservices-demo.yaml and watch the pods come up:

kubectl get pods -n debug-demo

Result

Once every service is healthy, visiting the LoadBalancer service shows the online shop UI and confirms that all pods are running correctly. These steps demonstrate a systematic approach to debugging Kubernetes applications by inspecting pod state, events, and resource definitions.