# Kubernetes Service

> A steady name and address for a changing group of pods. It shares traffic among them.

**Field:** Infrastructure  
**Category:** Container Orchestration  
**Also known as:** K8s Service, Service (Kubernetes), ClusterIP

## Think of it like

It is like a shop's phone number. The staff change shifts, but you always call the same number.

## Definition

A Kubernetes service gives a group of pods one steady name and address. Pods come and go, and each new one gets a new address. The service keeps track of which pods are alive right now. It picks them by a label, like app: shop. Any request sent to the service is passed on to one of those pods.

## Example

Jack's web pods call the database through a service named db. The database pod is replaced twice in a week, and the web pods never notice.

## Example code

```yaml
apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app.kubernetes.io/name: MyApp
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376
```

Requests to my-service on port 80 go to any pod with the MyApp label, on port 9376.

## Why it matters

With no service, each app would have to chase the new address of each pod it calls.

## Common mistake

Sending traffic straight to a pod's address. The next time that pod is replaced, the address is gone.

## Three principles

- **Steady address.** The name stays while pods change.
- **Picks by label.** It finds pods that carry its label.
- **Shares the load.** Requests are spread across the pods.

## Related terms

- [Kubernetes Pod](https://learn.benibix.com/term/infrastructure/kubernetes-pod)
- [Kubernetes Ingress](https://learn.benibix.com/term/infrastructure/kubernetes-ingress)
- [Kubernetes Deployment](https://learn.benibix.com/term/infrastructure/kubernetes-deployment)
- [Domain Name System (DNS)](https://learn.benibix.com/term/infrastructure/dns)
- [Network Port](https://learn.benibix.com/term/infrastructure/port)

## Told apart from

- [Kubernetes Service vs Kubernetes Ingress](https://learn.benibix.com/compare/kubernetes-service-vs-kubernetes-ingress): People think a service and an ingress do the same job, and they do not. A service gives a group of pods one steady address inside the cluster. An ingress lets web traffic in from outside, and sends each site or path to the right service. Traffic from the internet usually passes through both, the ingress first.

![Traffic from the internet enters on the left. An ingress reads the web address and sends shop.example.com to a service. The service spreads the requests across three identical pods. A dashed box around the three pods is marked deployment, which keeps three of them running.](https://learn.benibix.com/diagrams/inf-k8s-traffic.svg)

---

Source: https://learn.benibix.com/term/infrastructure/kubernetes-service
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
