Can't download plugins using kubernetes jenkins (Problem with kube-dns)

12/3/2018

I am having troubles with a Jenkins pod and with the kube-dns. It seems that my Jenkins is offline and I can't install any plugin, and this is because of the DNS.

This is the error that I'm obtaining: "UnknownHostException: updates.jenkins.io"

Because of this error, I cant download any plugin, so my Jenkins is totally useless.

I have exposed my deployment using "HostPort", in order to have my Jenkins in a private IP. It is important to say that this private IP has access to Internet, so my pod should have it too.

This is the content of the /etc/resolv of the pod:

jenkins@jenkins-86b49f4cb4-zchct:/$ cat /etc/resolv.conf
nameserver 10.0.0.10
search default.svc.cluster.local svc.cluster.local cluster.local reddog.microsoft.com
options ndots:5

And this is my kube-dns:

[root@azureutils1 ~]# kubectl get svc --namespace kube-system --insecure-skip-tls-verify
NAME                   TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)         AGE
heapster               ClusterIP   10.0.243.103   <none>        80/TCP          5d
kube-dns               ClusterIP   10.0.0.10      <none>        53/UDP,53/TCP   5d
kubernetes-dashboard   ClusterIP   10.0.237.105   <none>        80/TCP          5d
metrics-server         ClusterIP   10.0.34.149    <none>        443/TCP         5d

So the IP of the resolv.conf matches the IP of kube-dns service. If I expose my Jenkins using a public LoadBalancer I don't have this problem, but I want that my Jenkins stays in a private IP.

Any thought on this issue?

Greetings

-- Typh
jenkins
kube-dns
kubernetes
rancher

1 Answer

5/8/2019

This kind of issues happens because your pod DNS is not configured. It could be fixed by adding:

hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet

to spec of your pod.

-- Eugene Lopatkin
Source: StackOverflow