Service discovery tools maintain a registry of available service instances and their locations, allowing services to find each other dynamically at runtime; Eureka and Consul are the two most commonly used in Java/Spring ecosystems.
Key Points: • Eureka, built by Netflix and integrated tightly with Spring Cloud, is straightforward to set up and is popular specifically in Java/Spring Boot environments. • Consul, from HashiCorp, is language-agnostic and offers richer features like built-in health checking, key-value configuration storage, and multi-datacenter support. • Kubernetes provides its own native service discovery through DNS and Service objects, which is often sufficient when running entirely on K8s without needing Eureka or Consul. • Zookeeper is an older option, more commonly seen paired with Kafka than as a dedicated microservices registry today. • The choice often comes down to ecosystem fit: Eureka for pure Spring shops, Consul for polyglot environments needing more than just discovery.
Example: A polyglot company running Java, Go, and Python services might choose Consul specifically because its HTTP-based API and DNS interface work uniformly across all three languages, whereas Eureka's tooling is most convenient from within Spring applications.
Interview Tip: A concise interview answer is:
"Eureka and Consul are the two I see most often. Eureka is simple and integrates seamlessly with Spring Cloud, making it a natural fit for Java shops, while Consul offers broader language support and extra features like health checks and multi-datacenter support, which matters more in polyglot environments. On Kubernetes, native service discovery via DNS often removes the need for either."