This helpful advice was from @tsupertramp
for a in `kubectl get pods -n kube-system |grep kube-dns |grep -v autoscaler |cut -d ' ' -f 1 `;do for b in kubedns dnsmasq sidecar;do kubectl logs -n kube-system $a -c $b > $a-$b.log;done;done
=> Then you have logfiles of dns in your current directory. Then just look through the log files if there is anything like “warning” or “error”
It searches your pod names and then shows logs of each pods containers (it has three kubedns / dnsmasq / sidecar)
Then check output of:
kubectl describe deploy -n kube-system kube-dns
- All pods running happily?
After i created a new cluster i always check if all kubernetes deployments in the kube-system stack are running -
kubectl get deploy -n kube-system
The same for the daemonsets (if you use weave or calico as network stack)
kubectl get daemonsets -n kube-system
@tjanczuk has this great thing for dead docker containers
#!/usr/bin/env bash
while true
do
echo Cleaning up dead docker containers...
sudo docker ps -a -f status=dead -q | xargs -r -I % bash -c 'sudo rm -rf /var/lib/docker/overlay/%1*'
sudo docker ps -a -f status=dead -q | xargs -r sudo docker rm -f -v
echo Sleeping 10s before next container cleanup...
sleep 10
done
Also here is a more elaborate docker cleanup script.