A Service in Kubernetes is an object that provides a stable IP address, DNS name, and consistent network access to a group of Pods.
Because Pods are temporary β they die, restart, or get new IPs β a Service makes sure that:
- β Applications can find and talk to Pods reliably
- β Network traffic is load-balanced across Pods
- β The communication remains stable even if Pods change
π§ Why Services Exist
Pods are not permanent:
- Their IPs keep changing
- Pods come and go during scaling
- New Pods replace old Pods during deployments
Without Services, apps would have no stable way to reach Pods.
A Service hides Pod changes behind a fixed, reliable endpoint.
π― What a Service Provides
πΉ Stable ClusterIP
A virtual IP that does NOT change.
πΉ DNS name
Example:
myapp.default.svc.cluster.local
πΉ Load balancing
Traffic is automatically distributed to healthy Pods.
πΉ Service Discovery
Apps always know how to find each other.
ποΈ How Services Work Internally
A Service selects Pods using labels:
selector:
app: myapp
Then Kubernetes creates:
- Endpoints/EndpointSlices = list of Pod IPs behind the Service
- Rules in kube-proxy (iptables/ipvs) to route traffic
When you access the Service IP β kube-proxy forwards the request to one of the matching Pods.
π One-Line Interview Definition
A Service in Kubernetes is a stable networking endpoint that
provides consistent access, load balancing, and
discovery to a dynamic group of Pods.
Top comments (0)