Route demo app through Ingress at demo.ahmza.com

This commit is contained in:
2026-09-03 04:44:41 +01:00
parent 923cdd5162
commit bb69db8041
3 changed files with 54 additions and 21 deletions
+28
View File
@@ -0,0 +1,28 @@
# Routes requests for demo.ahmza.com through ingress-nginx (docs/11-ingress.md)
# to the demo Service's ClusterIP, on ingress-nginx's one shared address
# (10.10.60.12) instead of this app having its own dedicated MetalLB address.
#
# No ingressClassName is set here because apps/ingress-nginx/values.yaml
# marks its IngressClass as this cluster's default — the same "don't repeat
# yourself" convenience Longhorn gives PVCs that don't name a
# storageClassName.
#
# No TLS yet — see docs/12-cert-manager.md for adding a real HTTPS
# certificate for this exact hostname.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: demo
namespace: demo
spec:
rules:
- host: demo.ahmza.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: demo
port:
number: 80
+6 -16
View File
@@ -3,28 +3,18 @@
# time. This Service selects any Pod labelled app: demo (see
# deployment.yaml) and forwards traffic to it.
#
# type: LoadBalancer asks the cluster for a real, dedicated IP address that
# anything on your network can reach directly. On a cloud provider that
# would provision an actual cloud load balancer; on bare metal there's
# nothing to provision it, which is exactly the gap MetalLB
# (apps/metallb.yaml) fills — it watches for LoadBalancer Services and
# hands them an address from the pool configured in
# apps/metallb/templates/ipaddresspool.yaml. Until that pool exists, this
# Service's address will show as <pending>; see docs/05-metallb.md.
# 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
annotations:
# Requests this specific address from MetalLB's pool, so it stays
# predictable across rebuilds instead of getting whatever's next free.
# Must fall inside the range in
# apps/metallb/templates/ipaddresspool.yaml, or MetalLB will never
# satisfy the request.
metallb.io/loadBalancerIPs: "10.10.60.11"
spec:
type: LoadBalancer
selector:
app: demo
ports: