_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Service Discovery: How Services Find Each Other in a Dynamic Environment

12. 10. 2015 2 min read CORE SYSTEMSai
Service Discovery: How Services Find Each Other in a Dynamic Environment

In dynamic containerized environments, IP addresses and ports change constantly. Service discovery solves the fundamental problem — how services find each other.

Why Static Configuration Is Not Enough

In a traditional environment, a configuration file with service IP addresses is sufficient. In a containerized environment that no longer works — containers are created and destroyed dynamically, IP addresses change, and services scale horizontally.

Service discovery automatically registers services on startup and deregisters them on shutdown. Clients query the registry instead of using hardcoded addresses.

Client-Side vs. Server-Side Discovery

Two fundamental approaches:

Client-side discovery — the client queries the registry and selects an instance:

  • The client controls the load balancing strategy
  • Direct communication without an intermediary
  • Netflix Eureka + Ribbon is a typical example

Server-side discovery — the client calls a load balancer that handles routing:

  • Simpler for clients
  • Central point for monitoring
  • AWS ELB, Kubernetes Service are examples

Kubernetes uses server-side discovery with kube-dns for DNS-based resolution.

Consul, etcd, and ZooKeeper

Three popular tools for service discovery:

  • Consul (HashiCorp) — service discovery + health checking + KV store + multi-datacenter. The most complete solution.
  • etcd (CoreOS) — distributed KV store, the foundation of Kubernetes. Simple and reliable.
  • ZooKeeper (Apache) — the veteran, comprehensive, but higher operational costs.

Consul offers a DNS interface — services are accessible as service-name.service.consul, which simplifies integration.

Health Checking and Resilience

Service discovery without health checking is dangerous — clients may be routed to non-functional instances.

Consul supports:

  • HTTP health checks
  • TCP port checks
  • Script-based checks
  • TTL-based heartbeats

Combining service discovery with the circuit breaker pattern (Hystrix) ensures that the failure of one service does not cause a cascading outage of the entire system.

Conclusion: A Foundation of Microservices Infrastructure

Service discovery is an essential building block for microservices architecture. We recommend Consul as the default choice thanks to its complete feature set. In a Kubernetes environment, discovery is built in — but understanding the underlying principles is important there too.

service discoveryconsuletcdmicroservicesinfrastrukturadistribuované systémy
Share:

CORE SYSTEMS

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.

Need help with implementation?

Our experts can help with design, implementation, and operations. From architecture to production.

Contact us