canonical / microk8s

MicroK8s is a small, fast, single-package Kubernetes for datacenters and the edge.
https://microk8s.io
Apache License 2.0
8.4k stars 766 forks source link

Debugging kubelet #4666

Open mikeolasz opened 1 week ago

mikeolasz commented 1 week ago

I'm having troubles locating issues in my microk8s cluster. To be specific I have a pod that gets stuck in the ContainerCreating status and setting the log verbosity did not really help me since the log messages aren't useful enough. I was able to track the log message Starting operationExecutor.MountVolume... down to a reconciler_common.go file in the kubernetes implementation and no other logs are coming from the process (no MountVolume failed nor MountVolume started). I can see there's a condition when an error is expected and in that case the error does not get logged.

I'm getting out of ideas on how to figure out the root cause of the problem because none of the other components (PVC, CSI driver) emit any errors.

Is there a way to attach a debugger to kubelet or do you have any recommendation what I could look for?

louiseschmidtgen commented 1 week ago

Hello @mikeolasz,

you can have a look at the kubelet logs by running sudo journalctl -u snap.microk8s.daemon-kubelite -f. Kubelite is one of MicroK8s snap services if you wish to read more find our docs here: https://microk8s.io/docs/configuring-services and find more guidance on troubleshooting with microk8s here: https://microk8s.io/docs/troubleshooting.

If you require further help to debug your cluster please send us the inspection report generated from microk8s inspect.