Skip to content
Kubernetes Service Discovery
step 1/5

Reading — step 1 of 5

Read

~1 min readProduction

Kubernetes Service Discovery

Kubernetes solved discovery via:

Service object:

apiVersion: v1
kind: Service
metadata:
  name: billing
spec:
  selector:
    app: billing
  ports:
    - port: 80

This selects all PODS with app: billing label. The Service gets:

  • A stable cluster IP (e.g., 10.96.123.45)
  • A DNS name: billing.default.svc.cluster.local

Kube-proxy programs iptables/IPVS rules to LB connections to backend pods. Each pod has its own pod IP; service LB transparently spreads connections.

Endpoints object: actual backend list. Maintained by Kubernetes controllers based on label selectors.

Headless service: setting clusterIP: None. DNS returns ALL pod IPs (no LB). Used for stateful services where each pod is distinguishable (databases, queues).

External DNS: Service of type LoadBalancer triggers cloud provider to provision an external LB. AWS: an ALB. GCP: a network LB.

ExternalName: alias for an external DNS name. Useful for services running outside the cluster.

Kubernetes is the reference implementation of cloud-native service discovery. CoreDNS (the cluster DNS) reads Service resources from the API server.

Service mesh (Istio, Linkerd) ADDS:

  • mTLS between services
  • Fine-grained routing rules
  • Distributed tracing
  • Circuit breaking + retries

Built on top of Kubernetes' service abstraction.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…