Magick
Magick

Reputation: 5132

kubernetes.default: Name does not resolve

Im running OpenShift.

But am having problems trying to run a build in Jenkins (running in a pod). This is not a problem with the java code that I'm trying to build, but is a problem in the Kubernetes/Openshift setup.

The builds fail with:

Caused by: java.net.UnknownHostException: kubernetes.default: Name does not resolve
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
    at java.net.InetAddress.getAllByName(InetAddress.java:1192)
    at java.net.InetAddress.getAllByName(InetAddress.java:1126)
    at okhttp3.Dns$1.lookup(Dns.java:39)
    ...

Does anyone know how to fix this?

Upvotes: 0

Views: 12154

Answers (2)

Dashrath Mundkar
Dashrath Mundkar

Reputation: 9212

Please check on manage jenkins -> Configure Global Security -> Agent port is 50000 and Fixed

Upvotes: 0

pagid
pagid

Reputation: 13877

First confirm that DNS is actually working with:

› kubectl run -i -t busybox --image=busybox --restart=Never 
Waiting for pod default/busybox to be running, status is Pending, pod ready: false
If you don't see a command prompt, try pressing enter.

/ # nslookup kubernetes.default
Server:    192.168.60.10
Address 1: 192.168.60.10 kube-dns.kube-system.svc.cluster.local

Name:      kubernetes.default
Address 1: 192.168.60.1 kubernetes.default.svc.cluster.local

If that doesn't work check if the DNS pods are running:

kubectl get pods --namespace=kube-system -l k8s-app=kube-dns

Will respond sth like:

NAME                 READY     STATUS    RESTARTS   AGE
kube-dns-v14-3u5zi   3/3       Running   36         166d

Finally checking the related logs is worth a try:

kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c kube-dns
kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c dnsmasq
kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c healthz

Full instructions can be found on kubernetes.io

Upvotes: 0

Related Questions