How to fix "Name does not resolve": Kubernetes client exception when deploying simple Springboot app for tesing REST API?

6/28/2019

i am trying to deploy a springboot framework based application for testing REST API's. The application(server & client side) have been deployed through docker containers and kubernetes has been used for deploying and management of containers. The problem is that whenever i try to execute a query it returns this error:

2019-06-28 10:25:36.343 ERROR 1 --- [nio-8081-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is io.fabric8.kubernetes.client.KubernetesClientException: Operation: [create]  for kind: [Job]  with name: [null]  in namespace: [default]  failed.] with root cause

java.net.UnknownHostException: kubernetes.default.svc: Name does not resolve

i am working with minikube and i have tested my local deployment with busbox pod and the DNS has been correctly expose locally by minikube.

This is how the stacktrace look like:

java.net.UnknownHostException: kubernetes.default.svc: Name does not resolve
    at java.base/java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:na]
    at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929) ~[na:na]
    at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1515) ~[na:na]
    at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) ~[na:na]
    at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1505) ~[na:na]
    at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1364) ~[na:na]
    at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1298) ~[na:na]
    at okhttp3.Dns$1.lookup(Dns.java:40) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:185) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.connection.RouteSelector.nextProxy(RouteSelector.java:149) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:84) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:214) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[okhttp-3.12.0.jar!/:na]
    at io.fabric8.kubernetes.client.utils.BackwardsCompatibilityInterceptor.intercept(BackwardsCompatibilityInterceptor.java:119) ~[kubernetes-client-4.1.3.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[okhttp-3.12.0.jar!/:na]
    at io.fabric8.kubernetes.client.utils.ImpersonatorInterceptor.intercept(ImpersonatorInterceptor.java:68) ~[kubernetes-client-4.1.3.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[okhttp-3.12.0.jar!/:na]
    at io.fabric8.kubernetes.client.utils.HttpClientUtils.lambda$createHttpClient$1(HttpClientUtils.java:102) ~[kubernetes-client-4.1.3.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254) ~[okhttp-3.12.0.jar!/:na]
    at okhttp3.RealCall.execute(RealCall.java:92) ~[okhttp-3.12.0.jar!/:na]
-- rehan
kubernetes
minikube

0 Answers