2026-08-22 17:30:45 +01:00
|
|
|
# A Service gives a stable way to reach a set of Pods, even as individual
|
|
|
|
|
# Pods are created and destroyed and get new internal IP addresses over
|
|
|
|
|
# time. This Service selects any Pod labelled app: demo (see
|
|
|
|
|
# deployment.yaml) and forwards traffic to it.
|
|
|
|
|
#
|
2026-09-03 04:44:41 +01:00
|
|
|
# type is omitted here, so Kubernetes defaults to ClusterIP — reachable
|
|
|
|
|
# only from inside the cluster, no dedicated address of its own. That's
|
|
|
|
|
# deliberate now: docs/11-ingress.md routes this app through ingress-nginx's
|
|
|
|
|
# one shared address (10.10.60.12) by hostname instead, via ingress.yaml
|
|
|
|
|
# in this same folder. Compare with apps/whoami/service.yaml (deleted, but
|
|
|
|
|
# see docs/08) for what a dedicated type: LoadBalancer Service looked like.
|
2026-08-22 17:30:45 +01:00
|
|
|
apiVersion: v1
|
|
|
|
|
kind: Service
|
|
|
|
|
metadata:
|
|
|
|
|
name: demo
|
|
|
|
|
namespace: demo
|
|
|
|
|
spec:
|
|
|
|
|
selector:
|
|
|
|
|
app: demo
|
|
|
|
|
ports:
|
|
|
|
|
- port: 80
|
|
|
|
|
targetPort: 80
|