Does Spring Cloud Config Client support using Kubernetes as a discovery client?

2/15/2019

I am running a Spring Cloud Config Client on Kubernetes. It uses spring-cloud-kubernetes and spring-cloud-kubernetes-ribbon dependencies for service discovery, and I am expecting it to be able to discover the Spring Cloud Config Server by setting spring.cloud.config.discovery.enabled=true, but it is not working.

Background:

I am trying to prove that Kubernetes' Service is able to replace the Spring Cloud Eureka for Service Discovery with minimum configuration.

I have deployed a Spring Cloud Config Server (named config-server, at port 8888) along with a Spring Boot Microservice in Kubernetes as separate services in the same namespace, and used Spring Cloud Kubernetes' @EnableDiscoveryClient in the Application.java of both the config server and the microservice.

I have specified the following properties in the microservice's bootstrap.properties but the microservice always attempts to retrieve the config from localhost:8888:

spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.serviceId=config-server

Only when I have replaced the above configs with the following, can the configs from the server be retrieved successfully:

spring.cloud.config.enabled=true
spring.cloud.config.uri=http://config-server:8888
-- santankrish
java
kubernetes
spring-cloud
spring-cloud-config
spring-cloud-kubernetes

0 Answers