Alright, so I have two bare metal Kubernetes clusters, with no cloud providers. I have microservices written in spring boot. Now I want to build a production grade service discovery mechanism for inter-service communication.
My basic intention is to support multi-cluster service to service communication. So a microservice-1 on cluster-1 should be able to call microservice-2 on cluster-2. Fair enough ?
In pursuit of this, I spent countless hours in researching. I explored Native Kubernetes Service Discovery, Istio, Eureka etc but none of these could really serve my purpose.
I am finally thinking to settle down on Hashicorp’s Consul and Spring Cloud Consul project.
With the help of Consul’s Service Syncing, I was able to register the Kubernetes services (of type NodePort) to Consul on one cluster. So for now my Kubernetes cluster-1 and consul server are on the same Linux machine.
I have enabled spring cloud consul in my spring boot services but disabled their registration to Consul because if I enable the registration, Kubernetes pods will get registered in Consul. I want the Kubernetes Services to get registered so that when a client asks Consul about a target service, Consul can return the host and nodePort of the target service. Host and nodePort will enable me to call services across the clusters.
I have two questions for the community :
Also, if you guys have any better suggestions for achieving what I want then please let me know.
Apologies for a long textual question.