<p>I want to registry my java spring boot microservice into consul in kubernetes cluster, first step I add the consul dependencies using gradle:</p>
<pre><code>implementation &quot;org.springframework.cloud:spring-cloud-starter-consul-discovery&quot;
</code></pre>
<p>now I define the consul config like this in <code>application.properties</code>:</p>
<pre><code># registry center
spring.cloud.consul.host=consul-1630121482-headless.reddwarf-pro.svc.cluster.local
spring.cloud.consule.port=8500
spring.cloud.consul.enabled=true
spring.cloud.consul.discovery.health-check-interval=15s
spring.cloud.consul.discovery.instance-id= ${spring.application.name}:${server.port} 
</code></pre>
<p>but the consul shows error like this:</p>
<pre><code>Get &quot;http://dolphin-post-service-78f88c8c54-nrfbz:11014/actuator/health&quot;: dial tcp: lookup dolphin-post-service-78f88c8c54-nrfbz on 10.96.0.10:53: no such host
</code></pre>
<p>the consul access my service by pod name, so how to make the consul access the right url? I think the url should look like:</p>
<pre><code>dolphin-post-service-78f88c8c54-nrfbz.dolphin-post-service.reddwarf-pro.svc.cluster.local
</code></pre>
<p>so what should I do to make it work?</p>

Dolphin
<p>add this config to <code>applicaton.properties</code> use ip address:</p>
<pre><code>spring.cloud.consul.discovery.prefer-ip-address= true
</code></pre>
