io.fabric8.kubernetes.client.KubernetesClientException - java.net.UnknownHostException: kubernetes.d

1,793 views
Skip to first unread message

Charles Moulliard

unread,
Mar 9, 2016, 8:58:54 AM3/9/16
to fabric8
Hi,

From a parent pom project containing 2 maven modules where each module is a kubernetes application, I'm running this maven command

clean install docker:build fabric8:json fabric8:apply

to build the docker image and to deploy the kubernetes application into Vagrant Fabric8 VM

Here are the cmd/env vars defined 

oc new-project demo

export KUBERNETES_DOMAIN=vagrant.f8
export DOCKER_HOST=tcp://vagrant.f8:2375
export DOCKER_IP=vagrant.f8

Docker version of the plugin : 0.13.6
Fabric8 version of the plugin : 2.2.88

Unfortunately I get this error 

ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:2.2.0.redhat-621030:apply (default-cli) on project camel-rest-client: An error has occurred. java.net.UnknownHostException: kubernetes.default.svc: Unknown host kubernetes.default.svc -> [Help 1]
org
.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:fabric8-maven-plugin:2.2.0.redhat-621030:apply (default-cli) on project camel-rest-client: An error has occurred.
 at org
.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
 at org
.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
 at org
.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
 at org
.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
 at org
.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
 at org
.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
 at org
.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
 at org
.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
 at org
.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
 at org
.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
 at org
.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
 at org
.apache.maven.cli.MavenCli.main(MavenCli.java:158)
 at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java
.lang.reflect.Method.invoke(Method.java:497)
 at org
.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
 at org
.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
 at org
.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
 at org
.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred.
 at io
.fabric8.maven.ApplyMojo.execute(ApplyMojo.java:236)
 at org
.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
 at org
.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
 
... 19 more
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
 at io
.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:53)
 at io
.fabric8.kubernetes.client.dsl.internal.BaseOperation.getRootPaths(BaseOperation.java:135)
 at io
.fabric8.kubernetes.client.BaseClient.rootPaths(BaseClient.java:233)
 at io
.fabric8.kubernetes.api.KubernetesHelper.isOpenShift(KubernetesHelper.java:1839)
 at io
.fabric8.maven.ApplyMojo.execute(ApplyMojo.java:178)
 
... 21 more
Caused by: java.util.concurrent.ExecutionException: java.net.UnknownHostException: kubernetes.default.svc
 at com
.ning.http.client.providers.netty.future.NettyResponseFuture.abort(NettyResponseFuture.java:231)
 at com
.ning.http.client.providers.netty.request.NettyRequestSender.abort(NettyRequestSender.java:420)
 at com
.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithNewChannel(NettyRequestSender.java:288)
 at com
.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithCertainForceConnect(NettyRequestSender.java:140)
 at com
.ning.http.client.providers.netty.request.NettyRequestSender.sendRequest(NettyRequestSender.java:115)
 at com
.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:87)
 at com
.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:517)
 at com
.ning.http.client.AsyncHttpClient$BoundRequestBuilder.execute(AsyncHttpClient.java:229)
 at io
.fabric8.kubernetes.client.dsl.internal.BaseOperation.getRootPaths(BaseOperation.java:125)
 
... 24 more
Caused by: java.net.UnknownHostException: kubernetes.default.svc
 at java
.net.InetAddress.getAllByName0(InetAddress.java:1259)
 at java
.net.InetAddress.getAllByName(InetAddress.java:1171)
 at java
.net.InetAddress.getAllByName(InetAddress.java:1105)
 at java
.net.InetAddress.getByName(InetAddress.java:1055)
 at com
.ning.http.client.NameResolver$JdkNameResolver.resolve(NameResolver.java:28)
 at com
.ning.http.client.providers.netty.request.NettyRequestSender.remoteAddress(NettyRequestSender.java:356)
 at com
.ning.http.client.providers.netty.request.NettyRequestSender.connect(NettyRequestSender.java:367)
 at com
.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithNewChannel(NettyRequestSender.java:281)

This cmd is issued from the host (= Macosx) against the guest (= Fabric8 Virtualbox VM machine created using Fabric8 Vagrant Installer) 

Regards,

Charles

Charles Moulliard

unread,
Mar 9, 2016, 9:07:34 AM3/9/16
to fabric8
If I run the same command under one of my module, I don't have the error and the mvn cmd succeeds

James Strachan

unread,
Mar 9, 2016, 9:08:16 AM3/9/16
to Charles Moulliard, fabric8
this line should give you a clue...

java.net.UnknownHostException: kubernetes.default.svc

where is the maven build running? If its outside of a pod then it should be talking to the public API server (via oc login and found in ~/.kube).

Looks like you're not using a fabric8 upstream release of the maven plugin right?


--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
James
-------
Red Hat

Twitter: @jstrachan
Email: james.s...@gmail.com
hawtio: http://hawt.io/

Open Source DevOps and Integration

James Strachan

unread,
Mar 9, 2016, 9:09:05 AM3/9/16
to Charles Moulliard, fabric8
if the error is cause by running the mvn command in the root folder; then don't use explicit goals, but instead use profiles to only run the fabric8 / docker maven plugin on builds which contain docker apps - like the quickstarts do.

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Charles Moulliard

unread,
Mar 9, 2016, 9:33:27 AM3/9/16
to fabric8
Problem solved after moving the profile definition to the parent pom and add a missing link between a module and its parent pom 



On Wednesday, March 9, 2016 at 2:58:54 PM UTC+1, Charles Moulliard wrote:
...
Reply all
Reply to author
Forward
0 new messages