20077f1029
The haproxy edge holds its own DMZ VIP, a second public entry point alongside traefik-external that must be firewalled and DNS'd separately. Traefik can front it with TLS passthrough, leaving haproxy's certs and backends untouched. - Add a `traefik-external` Gateway: HTTP :80 plus Passthrough TLS :443. - TLSRoute the 12 `fe_https.map` hostnames to haproxy:443; HTTPRoute 301s :80. - Make the Service ClusterIP on 443 only, releasing 198.18.199.1. - Drop `fe_http`, `be_letsencrypt` and `fe_http.map`; certs are DNS-01 only. Client IP now reads as a Traefik pod — the Gateway provider cannot emit PROXY protocol to a TLSRoute backend. `sessionAffinity` goes too (it would pin Traefik pods, not clients); SRVNAME cookies keep persistence. Reviewed-on: #492 Co-authored-by: unkin-agent <unkin-agent@unkin.net> Co-committed-by: unkin-agent <unkin-agent@unkin.net>
149 lines
4.3 KiB
YAML
149 lines
4.3 KiB
YAML
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: haproxy
|
|
namespace: haproxy
|
|
annotations:
|
|
reloader.stakater.com/auto: "true"
|
|
spec:
|
|
replicas: 3
|
|
selector:
|
|
matchLabels:
|
|
app: haproxy
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxUnavailable: 1
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: haproxy
|
|
spec:
|
|
automountServiceAccountToken: false
|
|
terminationGracePeriodSeconds: 150
|
|
affinity:
|
|
podAntiAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
- labelSelector:
|
|
matchLabels:
|
|
app: haproxy
|
|
topologyKey: kubernetes.io/hostname
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 99
|
|
runAsGroup: 99
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
containers:
|
|
- name: haproxy
|
|
image: haproxy:3.2.24-alpine
|
|
imagePullPolicy: IfNotPresent
|
|
command:
|
|
- haproxy
|
|
- -W
|
|
- -db
|
|
- -f
|
|
- /usr/local/etc/haproxy/haproxy.cfg
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
readOnlyRootFilesystem: true
|
|
capabilities:
|
|
drop: [ALL]
|
|
# fe_https binds the privileged port 443 as uid 99, and the
|
|
# dst_port ACLs need the real port.
|
|
add: [NET_BIND_SERVICE]
|
|
ports:
|
|
- name: https
|
|
containerPort: 443
|
|
protocol: TCP
|
|
- name: health
|
|
containerPort: 8404
|
|
protocol: TCP
|
|
- name: metrics
|
|
containerPort: 8405
|
|
protocol: TCP
|
|
- name: stats
|
|
containerPort: 9090
|
|
protocol: TCP
|
|
lifecycle:
|
|
preStop:
|
|
exec:
|
|
# SIGUSR1 to the master soft-stops the workers; hard-stop-after
|
|
# caps the drain. Wait so kubelet holds SIGTERM until it is done.
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- kill -s USR1 1; while kill -0 1 2>/dev/null; do sleep 1; done
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: health
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 30
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: health
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
resources:
|
|
requests:
|
|
cpu: 200m
|
|
memory: 256Mi
|
|
limits:
|
|
cpu: 2
|
|
memory: 1Gi
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /usr/local/etc/haproxy
|
|
readOnly: true
|
|
- name: cert-unkin-net
|
|
mountPath: /etc/haproxy/certs/unkin-net
|
|
readOnly: true
|
|
- name: cert-main-unkin-net
|
|
mountPath: /etc/haproxy/certs/main-unkin-net
|
|
readOnly: true
|
|
- name: cert-ceph-unkin-net
|
|
mountPath: /etc/haproxy/certs/ceph-unkin-net
|
|
readOnly: true
|
|
- name: run
|
|
mountPath: /var/lib/haproxy
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: haproxy-config
|
|
# ssl-load-extra-files loads <crtfile>.key by default, so the key is
|
|
# projected next to the cert as tls.crt.key.
|
|
- name: cert-unkin-net
|
|
secret:
|
|
secretName: wildcard-unkin-net-tls
|
|
items:
|
|
- key: tls.crt
|
|
path: tls.crt
|
|
- key: tls.key
|
|
path: tls.crt.key
|
|
- name: cert-main-unkin-net
|
|
secret:
|
|
secretName: wildcard-main-unkin-net-tls
|
|
items:
|
|
- key: tls.crt
|
|
path: tls.crt
|
|
- key: tls.key
|
|
path: tls.crt.key
|
|
- name: cert-ceph-unkin-net
|
|
secret:
|
|
secretName: wildcard-ceph-unkin-net-tls
|
|
items:
|
|
- key: tls.crt
|
|
path: tls.crt
|
|
- key: tls.key
|
|
path: tls.crt.key
|
|
- name: run
|
|
emptyDir: {}
|
|
restartPolicy: Always
|