Eureka and Kubernetes
<p>I am putting together a proof of concept to help identify gotchas using Spring Boot/Netflix OSS and Kubernetes together. This is also to prove out related technologies such as Prometheus and Graphana.</p>
<p>I have a Eureka service setup which is starting with no trouble within my Kubernetes cluster. This is named discovery and has been given the name &quot;discovery-1551420162-iyz2c&quot; when added to K8 using</p>
<pre><code></code></pre>
<p>For my config server, I am trying to use Eureka based on a logical URL so in my bootstrap.yml I have</p>
<pre><code>server:
  port: 8889

eureka:
  instance:
    hostname: configserver
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://discovery:8761/eureka/

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/xyz/microservice-config
</code></pre>
<p>and I am starting this using</p>
<pre><code>kubectl run configserver --image=xyz/config-microservice --replicas=1 --port=8889
</code></pre>
<p>This service ends up running named as configserver-3481062421-tmv4d. I then see exceptions in the config server logs as it tries to locate the eureka instance and cannot.</p>
<p>I have the same setup for this using docker-compose locally with links and it starts the various containers with no trouble.</p>
<pre><code>discovery:
  image: xyz/discovery-microservice
  ports:
   - &quot;8761:8761&quot;
configserver:
  image: xyz/config-microservice
  ports:
   - &quot;8888:8888&quot;
  links:
   - discovery
</code></pre>
<p>How can I setup something like eureka.client.serviceUri so my microservices can locate their peers without knowing fixed IP addresses within the K8 cluster?</p>