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)