How to debug a kubernetes cluster?

10/30/2021

As the question shows, I have very low knowledge about kubernetes. Following a tutorial, I made a Kubernetes cluster to run a web app on a local server using Minikube. I have applied the kubernetes components and they are running but the Web-Server does not respond to HTTP requests. My problem is that all the system that I have created is like a black box for me and I have literally no idea how to open it and see where the problem is. Can you explain how I can debug such implementaions in a wise way. Thanks.

-- Bornak
kubernetes

2 Answers

10/30/2021

use a tool like https://github.com/kubernetes/kubernetes-dashboard

You can install kubectl and kubernetes-dashboard in a k8s cluster (https://kubernetes.io/docs/tasks/tools/install-kubectl/), and then use the kubectl command to query information about a pod or container, or use the kubernetes-dashboard web UI to query information about the cluster. For more information, please refer to https://kubernetes.io/

-- Jonathan Allen Grant
Source: StackOverflow

10/30/2021
kubectl get pods

will show you all your pods and their status. A quick check to make sure that all is at least running.

If there are pods that are unhealthy, then

kubectl describe pod <pod name>

will give some more information.. eg image not found etc

kubectl log <pod name> --all

is often the next step , use -f to follow the logs as you exercise your api.

It is possible to link up images running in a pod with most ide debuggers, but instructions will differ depending on language and ide used...

-- Jason Farmer
Source: StackOverflow