What is a Kubernetes Service?

In short
A Kubernetes Service is a stable way to reach a group of Pods over the network. Pods come and go, and their IP addresses change, but a Service gives clients one fixed address and name to connect to. It routes traffic to whichever healthy Pods currently match its selector.
The problem Services solve
In Kubernetes, your application runs as Pods. A Pod is a small unit that wraps one or more containers. Pods are ephemeral, which means they can be created and removed at any time. When a Deployment scales up, rolls out a new version, or replaces a failed Pod, the set of running Pods changes. Each new Pod also gets its own IP address.
This creates a practical problem. Imagine a frontend that needs to call a backend. The backend Pods keep changing, so the frontend cannot simply remember one IP address. It would need to track which Pods are alive and where they are. A Service removes that burden.
How it works
A Service is an object in the Kubernetes API, just like a Pod or a ConfigMap. Each Service defines a logical set of endpoints, usually Pods, and a policy for reaching them. The most common way to pick those Pods is a label selector. The Service looks for Pods with matching labels and keeps a list of them up to date.
The controller behind each Service keeps scanning for matching Pods. When the set changes, it updates the EndpointSlice objects that belong to that Service. EndpointSlices are the lists of network addresses behind a Service. Clients can read them through the Kubernetes API if their code is built to do service discovery that way.
Kubernetes also gives the Service its own stable IP address, called the cluster IP. Traffic sent to that address is forwarded to one of the matching Pods. Clients use the Service instead of individual Pod addresses, so the Pods behind it can change freely.
A simple example
Suppose you have Pods that listen on TCP port 9376 and carry the label app.kubernetes.io/name: MyApp. You can publish them with a manifest like this:
apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 targetPort: 9376
When you apply this file, Kubernetes creates a Service called my-service with the default ClusterIP type. Traffic to port 80 of the Service reaches port 9376 on a matching Pod. The port field is the port the Service listens on, and targetPort is the port on the Pod. If you leave out targetPort, it is set to the same value as port.
You can also name ports on Pods and refer to those names in targetPort. This lets you change the port number in a new version of your backend without breaking clients.
Services without selectors
A Service does not always need a selector. You might run a database outside the cluster, point a Service at a workload in another namespace, or move an application into Kubernetes step by step. In these cases you define the Service without a selector and create an EndpointSlice by hand. The EndpointSlice must be linked to the Service with the kubernetes.io/service-name label. The endpoint addresses must not be loopback or link-local, and they cannot be the cluster IP of another Service.
Note that the Kubernetes API server does not allow proxying to endpoints that are not mapped to Pods. Commands such as kubectl port-forward on a Service without a selector will fail for this reason.
Common mistakes
The most frequent problem is a selector that does not match any Pod labels. The Service then has no endpoints, and requests fail. Check that the labels on your Pods exactly match the selector. Another common mistake is mixing up port and targetPort. The port is what clients use, and targetPort is where the Pod actually listens.
Alternatives
A Service works at the level of network addresses and ports. If your workload speaks HTTP and you want to route by host name or path, an Ingress may suit you better. An Ingress lets you combine routing rules for several components behind one entry point. Ingress is not a Service type, so it works alongside Services rather than replacing them. The Gateway API is a newer family of extension APIs that offers more options than Ingress and Service.
FAQ
Is a Service the same as a Pod?
No. A Pod runs your containers, while a Service is a separate object that gives a stable address to a group of Pods. Pods can be replaced at any time, but the Service stays in place.
Do I need to change my application to use a Service?
Usually not. Your application can keep connecting to a fixed address and port, and Kubernetes handles the routing to the Pods behind it. Applications that prefer Kubernetes APIs can also read EndpointSlices directly.
What happens if no Pods match the selector?
The Service exists but has no endpoints, so traffic sent to it cannot reach an application. Checking that the Pod labels match the selector is the first step to fix this.
Can a Service point to something outside the cluster?
Yes. You can define a Service without a selector and add an EndpointSlice that lists addresses outside the cluster, such as an external database.
Sources
This page is based on the official documentation below. Read it for full detail.
Kubernetes Service — official documentation ↗Kubernetes Service in the news
Google Cloud Previews Network Services Monitoring for GKE Ambient Networking
Google Cloud has launched a preview of Network Services Monitoring, a tool that shows layer 4 network telemetry for GKE services alongside application context. It aims to let service owners and network teams troubleshoot from the same view.
Google Cloud Adds Kubernetes Events, Hardware Fault Links and Structured Logs to Ray on GKE
Google Cloud and KubeRay added Kubernetes platform events to the Ray Dashboard, forwarding of node GPU faults to affected clusters, on-demand JAX profiling on TPUs, and structured logs by default. The changes aim to show whether a Ray failure started in code, scheduling, or hardware.
Sandbox vendors pitch speed over security as agent breakouts raise questions
Stack Overflow's podcast examined how sandboxes isolate AI agents, following a Hugging Face breakout that the guests called both alarming and predictable. Vendors say most buyers pay for performance rather than security.


