IMLC.ME
Search…
en-US
How to resolve "no route to host" in Kubernetes
I ran into trouble today, without any reason, my apps in Microk8s cluster cannot resolve domain name
1
java.lang.RuntimeException: java.net.UnknownHostException: xxx.example.com: Temporary failure in name resolution
Copied!
And then I go to check the coredns log and see below log. 10.152.183.1:443 is the apiserver address
1
E0528 13:48:20.680081 1 reflector.go:125] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:98: Failed to list *v1.Service: Get https://10.152.183.1:443/api/v1/services?limit=500&resourceVersion=0: dial tcp 10.152.183.1:443: connect: no route to host
Copied!
I don't know what the root cause excactly is, but here is the solution
1
# For Kubernetes
2
systemctl stop kubelet
3
systemctl stop docker
4
iptables --flush
5
iptables -tnat --flush
6
systemctl start kubelet
7
systemctl start docker
Copied!
1
# For Microk8s
2
microk8s stop
3
systemctl stop docker
4
iptables --flush
5
iptables -tnat --flush
6
systemctl start docker
7
microk8s start
Copied!

References

Last modified 1yr ago
Copy link
Contents
References