I have a problem with k8s
hosted on my own bare-metal infrastructure.
The k8s was installed via kubeadm init
without special configuration, and then I apply CNI
plugin
Everything works perfectly expects external DNS resolution from Pod
to the external world (internet).
For example:
I have Pod
with the name foo
, if I invoke command curl google.com
I receive error
curl: (6) Could not resolve host: google.com
but if I invoke the same command on the same pod a second time I receive properly HTML
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
and if I repeat this command again I can receive errors with DNS resolution or HTML and so on.
this behavior is random sometimes I must hit 10times and get an error and on 11 hits I can receive Html
I also try to debug this error with this guide, but it does not help.
Additional information:
CoreDNS is up and running and have default config
apiVersion: v1
data:
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf {
max_concurrent 1000
}
cache 30
loop
reload
loadbalance
}
kind: ConfigMap
metadata:
name: coredns
and files /etc/resolv.conf
looks fine
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
the problem exists on Centos 8
(master, kubeadm init
) and on Debian 10
(node, kubeadm join
)
SELinux
in on permissive
and SWAP
is disabled
it is looks like after install k8s and weavenet problem appear even on the host machine.
I’m not certain where the problem came from either k8s or Linux.
It started after I have installed k8s.
what have I missed?
2
Answers
I can suggest using different CNI plugin and setting it up from scratch. Remember when using
kubeadm
, apply CNI plugin after you rankubeadm init
, then add worker nodes. Here you can find supported CNI plugins. If the problem still exists, it’s probably within your OS.Check /etc/resolv.conf. The conf file can set the nameserver to 8.8.8.8.