Services

🚀 What It Does

A Service in Kubernetes is an abstraction that defines a logical set of Pods and a policy by which to access them. It provides a stable network endpoint for accessing a group of Pods, even as the underlying Pods change (e.g. due to scaling or restarts).

🧩 Key Types of Services

  • ClusterIP (default): Exposes the service on an internal IP within the cluster. Only accessible from within the cluster.
  • NodePort: Exposes the service on a static port on each node’s IP. Useful for basic external access.
  • LoadBalancer: Provisions an external load balancer (if supported by the cloud provider) to expose the service.
  • ExternalName: Maps the service to a DNS name outside the cluster.

⚙️ How It Works

  1. Pods are created with specific labels.
  2. A Service uses a selector to match those Pods.
  3. The Service gets a stable IP and DNS name.
  4. Traffic sent to the Service is load-balanced across the matching Pods.
  5. If using NodePort or LoadBalancer, traffic can come from outside the cluster.

Kubernetes Service Kubernetes Service