<p>I am using spring cloud kubernetes with spring boot and necessary RBAC requirements needed for the project.</p>

<pre><code>&lt;!-- kubernetes --&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
            &lt;artifactId&gt;spring-cloud-starter-kubernetes&lt;/artifactId&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
            &lt;artifactId&gt;spring-cloud-starter-kubernetes-config&lt;/artifactId&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
            &lt;artifactId&gt;spring-cloud-starter-kubernetes-ribbon&lt;/artifactId&gt;
        &lt;/dependency&gt;
</code></pre>

<p>I have 2 microservices running in kubernetes </p>

<ol>
<li><code>my-service</code></li>
<li><code>some-service</code></li>
</ol>

<p>The <code>my-service</code> is running with spring boot 2.x and <code>some-service</code> is running with Spring boot 1.x. Both the services are exposed via the Kubernetes <code>Service</code> and with proper endpoints.</p>

<p>excerpt of <code>application.yaml</code> for <code>my-service</code> is as below.</p>

<pre><code>some-service:
      url: http://some-service:8080
      serviceName: some-service
</code></pre>

<p>And the FeignClient used is as below.</p>

<pre><code>//FeignClient(url = "${some-service.url}") // does not work either
@FeignClient(value = "${some-service.serviceName}")
@RequestMapping("/api")
public interface SomeServiceClient {
</code></pre>

<p>Also I have made <code>spring.cloud.kubernetes.discovery.enabled=false</code></p>

<p>With this in place I expect that <code>my-service</code> should be able to talk to <code>some-service</code> via kubernetes service discovery But I get this error.</p>

<pre><code>ERROR c.b.d.m.s.c.MatchCoordinator - error=FeignException: status 404 reading SomeServiceClient#get(Test
ion,Output) stacktrace=feign.FeignException: status 404 reading SomeServiceClient#get
</code></pre>

<p>I am unable to understand what am I doing wrong. Also I do not have the spring.application.name set for <code>some-service</code> since its a third party service.</p>

<p>Can someone please help. Also FYI that the services work properly with port-forwarding and if accessed via Ingress.</p>

chaosguru
<p>If you do not have a name set for some-service, and it's a 3rd party service, I think the better approach would be to call it via RestTemplate or something. </p>

<p>Feign client needs to have the service name configured and known, for it to call that particular service in the network using service discovery. </p>
