haproxy
by QuenchWorks
High-performance TCP and HTTP load balancer and reverse proxy known for reliability and fine-grained traffic control at scale. Hardened by QuenchWorks as a minimal, nonroot, CVE-gated image, cosign-signed and pinned by digest.
About this chart
Quenchworks HAProxy
Hardened HAProxy high-performance TCP/HTTP load
balancer on a minimal, nonroot, read-only-rootfs, CVE-gated image pinned by digest. Built
from source on Wolfi (no upstream distro binaries) with OpenSSL, PCRE2 (+JIT), zlib,
and Lua. Frontends listen on unprivileged ports: 8080 (http), 8443 reserved for
TLS, 8404 (stats + health). Stateless: this chart runs a Deployment.
Install
helm install lb oci://ghcr.io/quenchworks/charts/haproxy
Then reach it from inside the cluster:
# load-balanced traffic (the http_in frontend)
kubectl run lb-test --rm -it --image=curlimages/curl --restart=Never -- \
curl http://lb-haproxy:8080/
# stats + health
kubectl port-forward svc/lb-haproxy 8404:8404
curl http://127.0.0.1:8404/stats
curl http://127.0.0.1:8404/healthz
Verify the image
cosign verify ghcr.io/quenchworks/images/haproxy \
--certificate-identity-regexp 'https://github.com/quenchworks/.+' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
Each image also ships an SPDX SBOM and SLSA build provenance as attestations. Verify them with the GitHub CLI:
gh attestation verify oci://ghcr.io/quenchworks/images/haproxy \
--owner quenchworks
Configuration
The entire HAProxy config is driven by config.haproxyConfig, rendered verbatim into a
ConfigMap and mounted read-only at /etc/haproxy/haproxy.cfg (replacing the image's
sample). The default ships:
- a
global/defaultspair tuned for a nonroot, read-only-rootfs runtime (nouser/group/chroot/daemon; pidfile + admin socket under/var/lib/haproxy), - a
statslistener on:8404exposing/statsand a/healthzmonitor-uri (what the liveness/readiness probes hit), and - a sample http frontend on
:8080->backend app, which answers200itself until you point it at real servers.
Override config.haproxyConfig to run your own load-balancing topology:
config:
haproxyConfig: |
global
log stdout format raw local0
maxconn 4096
stats socket /var/lib/haproxy/admin.sock mode 660 level admin
defaults
log global
mode http
option httplog
timeout connect 5s
timeout client 50s
timeout server 50s
frontend stats
bind *:8404
stats enable
stats uri /stats
monitor-uri /healthz
frontend http_in
bind *:8080
default_backend app
backend app
server s1 10.0.0.1:80 check
server s2 10.0.0.2:80 check
Keep the stats/health listener on :8404 (or update service.statsPort and the
probes) and bind only unprivileged ports (>= 1024): the container runs as uid 1001
and cannot bind ports below 1024.
Values
| Key | Default | Description |
|---|---|---|
image.repository | ghcr.io/quenchworks/images/haproxy | Image repository. |
image.digest | (CI-maintained) | Image digest; repinned automatically after each green image build. |
image.pullPolicy | IfNotPresent | Image pull policy. |
replicaCount | 1 | Number of HAProxy replicas. |
config.haproxyConfig | (sample) | The full haproxy.cfg, rendered into a ConfigMap. |
resources | 50m/32Mi .. 500m/128Mi | Container resource requests/limits. |
service.type | ClusterIP | Service type. |
service.port | 8080 | Port for the http_in frontend (load-balanced traffic). |
service.statsPort | 8404 | Port for the stats + health endpoint. |
service.httpsPort | 443 | HTTPS (pod 8443), only with tls.enabled. |
tls.enabled | false | Appends a frontend on 8443 that terminates TLS (cert at /tls) and forwards to your :8080 frontend; your config can also bind ... ssl crt /tls/tls.crt. |
tls.existingSecret | "" | Use this kubernetes.io/tls Secret (1st choice). |
tls.certManager.enabled | false | Request a cert-manager Certificate from tls.certManager.issuerRef (2nd choice). |
tls.selfSigned.validityDays | 365 | Otherwise Helm generates a CA + certificate, kept across upgrades. |
serviceAccount.create | true | Create a ServiceAccount (token automount disabled). |
rbac.create | false | Create an (empty) Role + RoleBinding. |
networkPolicy.enabled | true | Create a NetworkPolicy. |
networkPolicy.allowExternal | true | Allow ingress from outside the namespace. |
podDisruptionBudget.enabled | true | Create a PodDisruptionBudget. |
podDisruptionBudget.minAvailable | 1 | Minimum available pods during disruption. |
ingress.enabled | false | Create an Ingress for this chart. HTTP only. |
ingress.className | "" | IngressClass to claim it. Empty leaves it unset, so the cluster default applies. |
ingress.annotations | {} | Controller annotations (rewrite targets, body size, cert-manager issuer, ...). |
ingress.servicePort | null | Backend port. Unset resolves service.port, then service.ports.http / .https. |
ingress.hosts | [] | e.g. [{host: app.example.com}]. A host with no paths gets a single / Prefix path. |
ingress.tls | [] | Standard Ingress TLS list, e.g. [{hosts: [app.example.com], secretName: app-tls}]. |
Common production knobs (podLabels, podAnnotations, nodeSelector, affinity,
tolerations, topologySpreadConstraints, extraEnvVars, extraVolumes,
extraVolumeMounts, initContainers, sidecars, podSecurityContext,
containerSecurityContext, probe overrides, ...) are wired through quench-common.
Security
- Runs as nonroot uid 1001 on a read-only root filesystem (writable
emptyDirvolumes at/var/lib/haproxyfor the pidfile + admin socket and at/tmp). - All Linux capabilities dropped;
runAsNonRootenforced viaquench-common. - Image is pinned by digest and signed with cosign (keyless / Sigstore).
Deploy haproxy with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has haproxy on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the charthaproxy is pinned at v0.0.20 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply