How To Debug Containers in a Kubernetes Cluster

This blog post will show you how to debug running containers on a Kubernetes cluster running on Azure AKS.

Kubectl Logs

To debug containers in Kubernetes, we need to use the logs command which taps into a container console and output everything that happens inside the containers.

The first command you should start with is the get pods command which will list all the pods that are running on your cluster and shown below.

kubectl get pods

Once you know the pods you need to debug, use the following command to debug the container.

kubectl logs deploycontainers-wordpress

If you would like to see your logs in real time use the -f option as shown below.

kubectl logs deploycontainers-wordpress -f 

Success! You're on the list.