Service Discovery and Configuration

The Problem

In dynamic environments (Kubernetes, auto-scaling), service IPs change constantly. How does Service A find Service B?

Service Discovery Patterns

PatternHowExample
DNS-basedServices register DNS names, resolved at call timeKubernetes Services (ClusterIP)
Registry-basedServices register with a registry, clients query itConsul, etcd, Eureka, NRF (5G)
Sidecar/MeshProxy handles discovery transparentlyIstio/Envoy service mesh

Kubernetes Service Discovery

# Service A calls Service B by DNS name:
http://order-service.default.svc.cluster.local:8080/orders
# Kubernetes DNS resolves to current pod IPs
# kube-proxy load-balances across healthy pods

Configuration Management

💡 Telecom Parallel

The NRF (Network Repository Function) in 5G SBA IS a service registry. NFs register their profiles, and other NFs discover them via NRF queries. Same pattern as Consul/etcd.

Key Takeaways