I am using spring cloud kubernetes with spring boot and necessary RBAC requirements needed for the project.
<!-- kubernetes -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-ribbon</artifactId>
</dependency>
I have 2 microservices running in kubernetes
my-service
some-service
The my-service
is running with spring boot 2.x and some-service
is running with Spring boot 1.x. Both the services are exposed via the Kubernetes Service
and with proper endpoints.
excerpt of application.yaml
for my-service
is as below.
some-service:
url: http://some-service:8080
serviceName: some-service
And the FeignClient used is as below.
//FeignClient(url = "${some-service.url}") // does not work either
@FeignClient(value = "${some-service.serviceName}")
@RequestMapping("/api")
public interface SomeServiceClient {
Also I have made spring.cloud.kubernetes.discovery.enabled=false
With this in place I expect that my-service
should be able to talk to some-service
via kubernetes service discovery But I get this error.
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
I am unable to understand what am I doing wrong. Also I do not have the spring.application.name set for some-service
since its a third party service.
Can someone please help. Also FYI that the services work properly with port-forwarding and if accessed via Ingress.