3

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
  • 43
  • 2
  • 6

2 Answers2

1

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
  • 2,351
  • 1
  • 22
  • 34
0

If you mean resolution it depends on how you have setup your cluster, networking and how you expose the service. If you use the default installation process in GKE with helm, the service will use ClusterIP as type and then resolution should just work. My clusterpolicy is ClusterFirst in the deployment.

I have added an entry to the kube-dns configmap for resolution of names over the VPC I'm using but that's not needed for public name resolution.

I can recommend this to start if you are stuck:

https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/

Then if you have a problem you cannot solve, try to update the question with as much details as possible. For example, go into the jenkins container and check /etc/resolv.conf and what nameserver is used. By default it's an IP in the Kubernetes cluster range, and that one is setup to do resolution via kube-dns.

Vincent Gerris
  • 7,228
  • 1
  • 24
  • 22