- List the cluster information. For example:
$ kubectl cluster-info
Kubernetes master is running at https://kubernetes.docker.internal:6443
KubeDNS is running at https://kubernetes.docker.internal:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
- List recent events in all namespaces and look for warnings and
errors such as the following. Note that a
Killing
event is
considered Normal
:
$ kubectl get events --all-namespaces
NAMESPACE LAST SEEN TYPE REASON OBJECT MESSAGE
kube-system 6m1s Warning Unhealthy pod/metrics-server-6b5c979cf8-t8496 Readiness probe failed: HTTP probe failed with statuscode: 500
kube-system 6m8s Warning Unhealthy pod/metrics-server-6b5c979cf8-t8496 Liveness probe failed: HTTP probe failed with statuscode: 500
kube-system 6m8s Normal Killing pod/metrics-server-6b5c979cf8-t8496 Container metrics-server failed liveness probe, will be restarted
- If metrics-server
is running, list total node resource usage. For example:
$ kubectl top node
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
docker-desktop 207m 3% 1830Mi 18%
- List all pods. For example:
$ kubectl get pods -o wide --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-system coredns-f9fd979d6-6hb96 1/1 Running 1 30h 10.1.0.7 docker-desktop <none> <none>
kube-system coredns-f9fd979d6-x7dhk 1/1 Running 1 30h 10.1.0.6 docker-desktop <none> <none>
kube-system etcd-docker-desktop 1/1 Running 1 30h 192.168.65.4 docker-desktop <none> <none>
kube-system kube-apiserver-docker-desktop 1/1 Running 1 30h 192.168.65.4 docker-desktop <none> <none>
kube-system kube-controller-manager-docker-desktop 1/1 Running 1 30h 192.168.65.4 docker-desktop <none> <none>
kube-system kube-proxy-fm942 1/1 Running 1 30h 192.168.65.4 docker-desktop <none> <none>
kube-system kube-scheduler-docker-desktop 1/1 Running 1 30h 192.168.65.4 docker-desktop <none> <none>
kube-system metrics-server-7f68754c9c-xkb2h 1/1 Running 0 16m 10.1.0.13 docker-desktop <none> <none>
kube-system storage-provisioner 1/1 Running 2 30h 10.1.0.8 docker-desktop <none> <none>
kube-system vpnkit-controller 1/1 Running 1 30h 10.1.0.9 docker-desktop <none> <none>
kubernetes-dashboard dashboard-metrics-scraper-79c5968bdc-4kpl2 1/1 Running 0 38m 10.1.0.11 docker-desktop <none> <none>
kubernetes-dashboard kubernetes-dashboard-9f9799597-x694s 1/1 Running 0 38m 10.1.0.10 docker-desktop <none> <none>
- Prints logs for a particular pod. For example:
$ kubectl logs metrics-server-7f68754c9c-xkb2h -n kube-system
I0428 21:16:26.210289 1 serving.go:325] Generated self-signed cert (/tmp/apiserver.crt, /tmp/apiserver.key)
[...]
Previous Section (Troubleshooting Kubernetes Recipes) |
Next Section (Kubernetes etcd Issues Recipe) |
Back to Table of Contents