Files
k8s-starter-pack/apps/demo/service.yaml
T

23 lines
850 B
YAML

# 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.
#
# 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.
apiVersion: v1
kind: Service
metadata:
name: demo
namespace: demo
spec:
selector:
app: demo
ports:
- port: 80
targetPort: 80