About "intialize the host network interface."
Issues and Contributing
About "intialize the host network interface." the log is provided in the following
Jenkins by default is trying to bind something to localhost.
while in kubernetes cluster where kube-dns may be not available or not stable and as a result
the binding action will be failed.
I wonder if Jenkins can provide some env entry to let Kubernetes user use it to get over this issue, Just like Sonarqube image do, please see https://github.com/SonarSource/docker-sonarqube/issues/58.
Thank you.
--> setting agent port for jnlp... done
Dec 09, 2016 10:17:25 PM hudson.model.UpdateCenter updateDefaultSite
WARNING: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail.
java.net.UnknownHostException: updates.jenkins-ci.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
at sun.net.www.http.HttpClient.New(HttpClient.java:308)
at sun.net.www.http.HttpClient.New(HttpClient.java:326)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at hudson.model.DownloadService.loadJSON(DownloadService.java:171)
at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:180)
at hudson.model.UpdateCenter.updateDefaultSite(UpdateCenter.java:2181)
at jenkins.install.SetupWizard.init(SetupWizard.java:167)
at jenkins.install.InstallState$3.initializeState(InstallState.java:105)
at jenkins.model.Jenkins.setInstallState(Jenkins.java:1010)
at jenkins.install.InstallUtil.proceedToNextStateFrom(InstallUtil.java:96)
at jenkins.model.Jenkins.<init>(Jenkins.java:927)
at hudson.model.Hudson.<init>(Hudson.java:85)
at hudson.model.Hudson.<init>(Hudson.java:81)
at hudson.WebAppMain$3.run(WebAppMain.java:231)
Dec 09, 2016 10:17:25 PM hudson.WebAppMain$3 run
INFO: Jenkins is fully up and running
Dec 09, 2016 10:17:25 PM hudson.model.AsyncPeriodicWork$1 run
INFO: Finished Download metadata. 20,081 ms
Dec 09, 2016 10:17:45 PM javax.jmdns.impl.HostInfo newHostInfo
WARNING: Could not intialize the host network interface on nullbecause of an error: white-jenkins-1462756817-nvfhx: white-jenkins-1462756817-nvfhx: Name or service not known
java.net.UnknownHostException: white-jenkins-1462756817-nvfhx: white-jenkins-1462756817-nvfhx: Name or service not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
at javax.jmdns.impl.HostInfo.newHostInfo(HostInfo.java:75)
at javax.jmdns.impl.JmDNSImpl.<init>(JmDNSImpl.java:407)
at javax.jmdns.JmDNS.create(JmDNS.java:60)
at hudson.DNSMultiCast$1.call(DNSMultiCast.java:33)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.UnknownHostException: white-jenkins-1462756817-nvfhx: Name or service not known
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.getLocalHost(InetAddress.java:1500)
... 9 more
Docker commands that you execute
I use kubernetes command
# kubectl create -f deploy-jenkins.yaml
the deploy-jenkins.yaml is
# cat deploy-jenkins.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: white-jenkins
namespace: white
spec:
replicas: 1
selector:
matchLabels:
run: white-jenkins
template:
metadata:
labels:
run: white-jenkins
spec:
containers:
- image: jenkins:2.19.3
imagePullPolicy: Always
name: white-jenkins
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 50000
protocol: TCP
[root@k8s-09 ~]#
Actual result
In the container I check the value of /etc/hostname
# kubectl exec white-jenkins-1462756817-nvfhx --namespace=white -it -- cat /etc/hostname
white-jenkins-1462756817-nvfhx
This is done by Kubernetes if I am right, from http://kubernetes.io/docs/user-guide/pods/ we can see "The hostname is set to the pod’s Name for the application containers within the pod. "
Expected outcome
If the hostname can not be resolved. Let Jenkins bind to 127.0.0.1 or providing and key in env to let user set it and let Jenkins firstly check this env 's value.
Have you tried a non-dockerized Jenkins and get the expected outcome?
I think this is special issue in Kubenetes environment. I think Jenkins image will work in Docker environment.
Output of docker version
# kubectl version
Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.4", GitCommit:"3b417cc4ccd1b8f38ff9ec96bb50a81ca0ea9d56", GitTreeState:"clean", BuildDate:"2016-10-21T02:48:38Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.4", GitCommit:"3b417cc4ccd1b8f38ff9ec96bb50a81ca0ea9d56", GitTreeState:"clean", BuildDate:"2016-10-21T02:42:39Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Other relevant information
I think you can just set JENKINS_OPTS to --httpListenAddress=127.0.0.1, have you tried?
Hi @carlossg, Thank you for your feedback. I test and find it does not work. no matter I using env or args
$ cat deploy-jenkins.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: white-jenkins-2
namespace: white
spec:
replicas: 1
selector:
matchLabels:
run: white-jenkins-2
template:
metadata:
labels:
run: white-jenkins-2
spec:
containers:
- env:
- name: JENKINS_OPTS
value: --httpListenAddress=127.0.0.1
image: jenkins:2.19.3
imagePullPolicy: Always
name: white-jenkins-2
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 50000
protocol: TCP
[root@k8s-09 ~]#
$ cat deploy-jenkins.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: white-jenkins-2
namespace: white
spec:
replicas: 1
selector:
matchLabels:
run: white-jenkins-2
template:
metadata:
labels:
run: white-jenkins-2
spec:
containers:
- env:
- name: JENKINS_ARGS
value: --httpListenAddress=127.0.0.1
image: jenkins:2.19.3
imagePullPolicy: Always
name: white-jenkins-2
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 50000
protocol: TCP
$ cat deploy-jenkins.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: white-jenkins-2
namespace: white
spec:
replicas: 1
selector:
matchLabels:
run: white-jenkins-2
template:
metadata:
labels:
run: white-jenkins-2
spec:
containers:
- args:
- --httpListenAddress=127.0.0.1
image: jenkins:2.19.3
imagePullPolicy: Always
name: white-jenkins-2
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 50000
protocol: TCP
From the logs
Dec 09, 2016 10:17:45 PM javax.jmdns.impl.HostInfo newHostInfo
....
at hudson.DNSMultiCast$1.call(DNSMultiCast.java:33)
I guess this is about DNS where it get value of host name from the environment of container, the host name is the pod name This is special in k8s. Jenkins seems can not adapt to it by far If this is true is there related environment variable we can provide?
Your container doesn't have correct DNS resolution, it can't resolve UnknownHostException: updates.jenkins-ci.org so I guess you have some issue on your kubernetes setup
Yes. Your are right. The kube-dns cannot work in my k8s cluster now. Once the kube-dns is available I will test this again. Thank you! @carlossg
Hey @carlossg
May I know if updates.jenkins-ci.org is hard code in Jenkins?
Is there some way to configure it as its IP address directly as a work around when kube-dns cannot work.
Thank you!
You can overwrite any dns resolution in kubernetes with HostAliases
I am experiencing the same issue when running on Docker swarm.
WARNING: Could not intialize the host network interface on nullbecause of an error: 45a5ea3d380d: 45a5ea3d380d: Name does not resolve
java.net.UnknownHostException: 45a5ea3d380d: 45a5ea3d380d: Name does not resolve