A service in Kubernetes is an abstraction that defines a logical set of pods and a policy to access them. It provides a stable endpoint (IP address and DNS name) for accessing a group of pods, allowing for load balancing and service discovery. Key features of services include:
- Stable Network Identity: Services provide a consistent IP address and DNS name, even if the underlying pods change.
- Load Balancing: Distributes traffic across multiple pods to ensure high availability and reliability.
- Service Types: Kubernetes supports different service types, including:
- ClusterIP: Exposes the service on a cluster-internal IP. This is the default type.
- NodePort: Exposes the service on each node's IP at a static port.
- LoadBalancer: Creates an external load balancer in supported cloud providers.
- ExternalName: Maps the service to the contents of the externalName field (e.g., a DNS name).
Services are essential for enabling communication between different components of an application running in a Kubernetes cluster.
