<p>The microservices are getting registered to Eureka with the pod name as hostname, this causing UnknownHostException, when the Zull API gateway trying to forward the request to the service.</p>

<p>The complete setup working fine with the docker-compose, the issues are happening when I am trying to use the Kubernetes.</p>

<p>For example, the order microservice running with the pod name as "<code>oc-order-6b64576f4b-7gp85</code>" and the order microservice getting register to to Eureka with "<code>oc-order-6b64576f4b-7gp85</code>" as the hostname. Which is causing </p>

<pre><code>java.net.UnknownHostException: oc-order-6b64576f4b-7gp85: Name does not resolve
</code></pre>

<p>I am running just one instance of each micro-services as a POC and one instance of the Eureka server. How to fix, how micro-service can register them self with the right hostname.</p>

<p>I want to use the Eureka as discovery service as it is well integrated with spring boot and I do not want to do code changes for Kubernetes deployment.</p>

<p>Add the below property to your spring properties file in each service project:</p>
<pre><code>eureka.instance.hostName=${spring.application.name}
</code></pre>
<p>or (if you want a different name than the spring application name)</p>
<pre><code>eureka.instance.hostName=&lt;custom-host-name&gt;
</code></pre>
<p>Spring boot will now register with the provided hostname in Eureka</p>
