From e084ce4ecf39f19d08ec97fee852f59310e0cdbb Mon Sep 17 00:00:00 2001 From: hermes Date: Sat, 21 Nov 2026 20:36:59 +0100 Subject: [PATCH] feat(ingress): route public domains to Swarm backends (#14) ## Summary Make Kubernetes Traefik the common HTTP entrypoint while preserving the existing Swarm-hosted public domains. ## Routing - `hermes.rudolf.keenetic.link` -> Kubernetes Service `hermes:9119` - `brencher.rudolf.keenetic.link` -> `192.168.1.96:5001` - `immich.rudolf.keenetic.link` -> `192.168.1.96:2283` - `gitea.rudolf.keenetic.link` -> `192.168.1.96:3002` The Swarm targets are represented by selectorless Services with static Endpoints. The router can use ordinary TCP forwarding to `192.168.1.114:80`, preserving the HTTP `Host` header for Traefik routing instead of using the Keenetic HTTP reverse-proxy feature. ## Validation - `git diff --cached --check` passed - Changed files are limited to the Hermes ingress, backend Services/Endpoints, Kustomization, and README - `kubectl kustomize` was unavailable in the execution environment Reviewed-on: https://gitea.rudolf.keenetic.link/org1/infra/pulls/14 Reviewed-by: admin Co-authored-by: hermes --- k3s_rencher/infrastructure/ingress/README.md | 15 ++++ .../infrastructure/ingress/kustomization.yaml | 5 ++ .../ingress/public-ingress.yaml | 40 ++++++++++ .../ingress/swarm-backends.yaml | 80 +++++++++++++++++++ kustomization.yaml | 1 + 5 files changed, 141 insertions(+) create mode 100644 k3s_rencher/infrastructure/ingress/README.md create mode 100644 k3s_rencher/infrastructure/ingress/kustomization.yaml create mode 100644 k3s_rencher/infrastructure/ingress/public-ingress.yaml create mode 100644 k3s_rencher/infrastructure/ingress/swarm-backends.yaml diff --git a/k3s_rencher/infrastructure/ingress/README.md b/k3s_rencher/infrastructure/ingress/README.md new file mode 100644 index 0000000..8e16c3b --- /dev/null +++ b/k3s_rencher/infrastructure/ingress/README.md @@ -0,0 +1,15 @@ +# Shared public ingress + +The common Traefik entrypoint routes public domains to Kubernetes and Swarm +backends. The router forwards TCP port `80` to `xu4_lan` (`192.168.1.114`). + +| Domain | Backend | +| --- | --- | +| `hermes.rudolf.keenetic.link` | Kubernetes Service `hermes:9119` | +| `brencher.rudolf.keenetic.link` | Swarm `192.168.1.96:5001` | +| `immich.rudolf.keenetic.link` | Swarm `192.168.1.96:2283` | +| `gitea.rudolf.keenetic.link` | Swarm `192.168.1.96:3002` | + +The Swarm backends are represented by selectorless Kubernetes Services and +static Endpoints. The Swarm ports must remain reachable from the Traefik node +at `192.168.1.96`. diff --git a/k3s_rencher/infrastructure/ingress/kustomization.yaml b/k3s_rencher/infrastructure/ingress/kustomization.yaml new file mode 100644 index 0000000..309c3e6 --- /dev/null +++ b/k3s_rencher/infrastructure/ingress/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - swarm-backends.yaml + - public-ingress.yaml diff --git a/k3s_rencher/infrastructure/ingress/public-ingress.yaml b/k3s_rencher/infrastructure/ingress/public-ingress.yaml new file mode 100644 index 0000000..ddf2c6f --- /dev/null +++ b/k3s_rencher/infrastructure/ingress/public-ingress.yaml @@ -0,0 +1,40 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: public-ingress + namespace: hermes + labels: + app.kubernetes.io/name: public-ingress +spec: + ingressClassName: traefik + rules: + - host: brencher.rudolf.keenetic.link + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: brencher-swarm + port: + name: http + - host: immich.rudolf.keenetic.link + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: immich-swarm + port: + name: http + - host: gitea.rudolf.keenetic.link + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: gitea-swarm + port: + name: http diff --git a/k3s_rencher/infrastructure/ingress/swarm-backends.yaml b/k3s_rencher/infrastructure/ingress/swarm-backends.yaml new file mode 100644 index 0000000..0d096c8 --- /dev/null +++ b/k3s_rencher/infrastructure/ingress/swarm-backends.yaml @@ -0,0 +1,80 @@ +apiVersion: v1 +kind: Service +metadata: + namespace: hermes + name: brencher-swarm + labels: + app.kubernetes.io/name: brencher-swarm +spec: + ports: + - name: http + port: 5001 + targetPort: 5001 + protocol: TCP +--- +apiVersion: v1 +kind: Endpoints +metadata: + namespace: hermes + name: brencher-swarm +subsets: + - addresses: + - ip: 192.168.1.96 + ports: + - name: http + port: 5001 + protocol: TCP +--- +apiVersion: v1 +kind: Service +metadata: + namespace: hermes + name: immich-swarm + labels: + app.kubernetes.io/name: immich-swarm +spec: + ports: + - name: http + port: 2283 + targetPort: 2283 + protocol: TCP +--- +apiVersion: v1 +kind: Endpoints +metadata: + namespace: hermes + name: immich-swarm +subsets: + - addresses: + - ip: 192.168.1.96 + ports: + - name: http + port: 2283 + protocol: TCP +--- +apiVersion: v1 +kind: Service +metadata: + namespace: hermes + name: gitea-swarm + labels: + app.kubernetes.io/name: gitea-swarm +spec: + ports: + - name: http + port: 3002 + targetPort: 3002 + protocol: TCP +--- +apiVersion: v1 +kind: Endpoints +metadata: + namespace: hermes + name: gitea-swarm +subsets: + - addresses: + - ip: 192.168.1.96 + ports: + - name: http + port: 3002 + protocol: TCP diff --git a/kustomization.yaml b/kustomization.yaml index e090685..25a453a 100644 --- a/kustomization.yaml +++ b/kustomization.yaml @@ -4,6 +4,7 @@ resources: - k3s_rencher/flux-system - k3s_rencher/infrastructure/dns - k3s_rencher/infrastructure/agent-gateway + - k3s_rencher/infrastructure/ingress - k3s_rencher/apps/hermes - k3s_rencher/apps/hermes/generic1 - k3s_rencher/apps/hermes/generic2