By Kevin McAleer, 6 Minutes
Page last updated November 24, 2026

By the end of this lesson you will be able to choose between ClusterIP, NodePort and LoadBalancer Services, and publish an app on a friendly web address using a Traefik Ingress.
Pods get a new IP every time they are recreated, so you never talk to a pod directly. A Service gives a group of pods one stable name and address, and spreads traffic across them.
| Type | What it does | Reachable from |
|---|---|---|
| ClusterIP | The default. A stable address inside the cluster | Other pods only |
| NodePort | Also opens a port (30000 to 32767) on every node | Your network, by node IP and port |
| LoadBalancer | Asks for an external address | Your network. K3s’s ServiceLB provides it |
On a cloud cluster, a LoadBalancer gets an address from the cloud provider. On a bare Pi cluster there is no cloud, so K3s bundles ServiceLB, which makes LoadBalancer services work by running small pods that use the nodes’ own addresses.
With NodePort, every app needs its own odd port number. An Ingress lets many apps share ports 80 and 443 and routes by host name or path. K3s bundles Traefik as the ingress controller, and it publishes itself through ServiceLB on ports 80 and 443 of your nodes.
flowchart LR
B["Browser<br/>http://hello.test"] --> N["Any node :80<br/>ServiceLB"]
N --> T["Traefik<br/>ingress controller"]
T -->|"Host hello.test"| S1["Service hello"]
T -->|"Host other.test"| S2["Service other"]
S1 --> P1["hello pods"]
S2 --> P2["other pods"]
Create hello.yaml. It holds a Deployment, a ClusterIP Service and an Ingress, separated by ---:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello
spec:
replicas: 2
selector:
matchLabels:
app: hello
template:
metadata:
labels:
app: hello
spec:
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: hello
spec:
selector:
app: hello
ports:
- port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
spec:
rules:
- host: hello.test
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hello
port:
number: 80
kubectl apply -f hello.yaml
kubectl get ingress
The ADDRESS column fills in with your node addresses once Traefik has picked the Ingress up.
The Ingress only matches requests with the host name hello.test. The quickest test needs no setup, because you can send the host name yourself:
curl -H "Host: hello.test" http://192.168.1.100/
You should get the nginx welcome page HTML. To use a browser, add a line to your computer’s hosts file (/etc/hosts on Linux and macOS), pointing the name at a node’s address:
192.168.1.100 hello.test
Then browse to http://hello.test. I use .test because it is reserved for testing and never clashes with a real domain, unlike .local, which is used by mDNS. Any node’s address works, because ServiceLB listens on all of them.
If you ask for an address Traefik has no rule for, it replies 404 page not found. That is Traefik working: it just has no route for that name.
kubectl get svc -A
kubectl get pods -n kube-system -l app.kubernetes.io/name=traefik
In the first list, find the traefik Service of type LoadBalancer with ports 80 and 443. Because ServiceLB uses real ports on the nodes, two LoadBalancer services cannot both use port 80 on the same node.
HTTPS with a real Let’s Encrypt certificate needs a public domain name and ports open to the internet, which is outside this course. We cover a safer local approach to TLS in lesson 16.
Teachers: Ingress by host name needs each learner to edit their own hosts file, which school computers often forbid. The
curl -H "Host: ..."form works without any changes and is a good fallback. On a shared cluster, give every learner a different host name such asalice.test, or two apps will fight over one name.
kubectl delete -f hello.yaml
curl -H "Host: hello.test".hello2.test, apply it, and confirm the old name now returns 404.httpd:alpine) with its own Service and a second Ingress host, and reach both from the same node address.type: NodePort, apply it, and compare how you reach the app.404 page not found.host:, and that kubectl get ingress shows the rule.Why: Traefik routes by host name, and an unmatched request has nowhere to go.
503 Service Unavailable.kubectl get endpoints hello and make sure it lists pod addresses. Check the Service selector matches the pod labels.Why: The Ingress found a Service, but the Service had no healthy pods behind it.
LoadBalancer service stays Pending.Quick quiz 1 of 3
Which K3s component routes web traffic by host name?
Quick quiz 2 of 3
What does ServiceLB do?
Quick quiz 3 of 3
What is the range for a NodePort?
Comments