Video in progress
If you run on Kubernetes, do you need Eureka or Consul?
In most cases no: a Kubernetes Service and DNS do the discovery, and kube-proxy does the balancing. You need Eureka when there are services outside the cluster, complex client-side balancing, or several clusters to join together.
📖 Answer
In Kubernetes, if you create a Service named payment-service, other pods call it at http://payment-service:8080. DNS returns the Service's ClusterIP, and kube-proxy routes the request to one of the ready pods (those that passed readiness). If a pod dies or fails readiness, it drops out of the endpoint list automatically. That is nearly everything Eureka does.
Running both systems together does harm too: you get two sources of truth. Eureka says the pod is "alive", while Kubernetes has already removed it, and so on.
One subtle point: kube-proxy balances at the connection level, not the request level. With HTTP/1.1 keep-alive or gRPC (HTTP/2), one long-lived connection sticks to one pod. When new pods are added, they get no load. A headless Service with client-side balancing, or a service mesh (Istio, Linkerd), solves this.
There is also Spring Cloud Kubernetes: it implements the DiscoveryClient interface on top of the Kubernetes API. If existing code is tied to DiscoveryClient, it makes the migration easier.
My usual choice: if a new project runs on Kubernetes, use only Kubernetes Services, with no Eureka.
Sign up to mark studied questions and save your progress.