Services provide stable network entry points to groups of Pods. Since Pods are ephemeral and their IP addresses change with each deployment, Services solve the fundamental problem of service discovery in dynamic environments.
Core Functions
Service Discovery - Services provide a stable DNS name and IP address that remains constant even as the underlying Pods come and go. Clients connect to the Service, not individual Pods.
Load Balancing - Traffic to a Service is automatically distributed across all healthy Pods that match the Service’s label selector. This built-in load balancing adapts automatically as Pods scale up or down.
Stable Network Entry Point - While Pod IPs are ephemeral, a Service’s ClusterIP remains stable. This stability decouples service consumers from the dynamic nature of Pod lifecycles.
Selection Mechanism
Services use Labels to identify which Pods they route traffic to. A Service continuously watches for Pods matching its label selector, automatically adding new Pods and removing terminated ones from its routing pool.
Service Types
ClusterIP (default) - Exposes the Service on an internal cluster IP. Only accessible within the cluster.
NodePort - Exposes the Service on each node’s IP at a static port. Accessible from outside the cluster but requires managing port conflicts.
LoadBalancer - Creates an external load balancer (in cloud environments) that routes to the Service.
ExternalName - Maps a Service to a DNS name, enabling abstract references to external services.
Network Isolation
Within Namespaces, Services provide logical network boundaries. Combined with Network Policies, Services enable fine-grained control over which Pods can communicate.
Runtime Dependencies
Services are a critical runtime dependency. Rather than hardcoding Pod IPs, applications discover dependencies through Service DNS names, enabling zero-downtime deployments, independent scaling, and environment portability.