Kubernetes Debug Cheatsheet - rivernews/iriversland2-kubernetes GitHub Wiki
Pods level
- Service server (microservice)
- Ingress controller
- Cert manager, and its related resources
Resources level
- Deployment
-
Descriptive:
kubectl describe
- will show the events -
Logging - pod level:
kubectl logs --follow -n <name space> <pod name>
-
Watch - resource level:
kubectl get pods/pod<+pod name> -n <> -w
-
Watch - observing rollout update: See the kubernetes doc on this.
-
Additional tools - run a test container. This is useful especially for dns / ingress related issues.
kubectl run busybox --image busybox -n cert-manager --restart=Never --rm -it -- sh
-
Debugging failed job provisioned by cronjob: the easiest way is to trigger the cronjob, and observe the log. This is because failed job after awhile its pods seems to be wiped away, thus unavailable to retrieve its log (can only check log on pod). Do this: 1.
get pods -w
, 2. for convenience, can log into digitalocean's kubernetes dashboard, go to cronjob - there will have a "Trigger" button, click on it and you should see the pod showing up in terminal. 3. You can see the pod name, then create another terminal and runlogs <pod name>
.
- Debugging for ingress resource. Here is our legacy script that we used to debug ingress and certificate.
- Debug and troubleshooting TLS