Back to Practice
Lab

Exposing Workloads with Services

Front a Deployment with a Service so it has one stable address, and make the selector match its Pods.

Your mission

Pods are disposable: they come and go, and each one gets a fresh IP. Anything that needs to reach your application can't chase those moving addresses. A Service solves this by giving a set of Pods one stable name and virtual IP, and load-balancing across whichever Pods currently match.

The wiring that makes it work is the selector: a Service forwards to every Pod whose labels match its selector. Get that label wrong and the Service is a dead end — it exists, has an IP, and routes to nothing. That single mismatch is the most common "my Service returns nothing" bug in the real world.

In this lab you run a replicated Deployment and put a ClusterIP Service in front of it with a matching selector.

Useful aliases

In your terminal, k is aliased to kubectl and completion is configured. The jumpbox also has k9s, jq and yq installed.

Skills you'll put into practice

servicesnetworkingworkloads

Make it your own.

Use this topic as a starting point for a fresh custom scenario.

Create a variation