haproxy

by QuenchWorks

Helm chartv0.0.20App 3.4.0GPL-2.0-or-laterVerified publisher

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/defaults pair tuned for a nonroot, read-only-rootfs runtime (no user/group/chroot/daemon; pidfile + admin socket under /var/lib/haproxy),
  • a stats listener on :8404 exposing /stats and a /healthz monitor-uri (what the liveness/readiness probes hit), and
  • a sample http frontend on :8080 -> backend app, which answers 200 itself 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

KeyDefaultDescription
image.repositoryghcr.io/quenchworks/images/haproxyImage repository.
image.digest(CI-maintained)Image digest; repinned automatically after each green image build.
image.pullPolicyIfNotPresentImage pull policy.
replicaCount1Number of HAProxy replicas.
config.haproxyConfig(sample)The full haproxy.cfg, rendered into a ConfigMap.
resources50m/32Mi .. 500m/128MiContainer resource requests/limits.
service.typeClusterIPService type.
service.port8080Port for the http_in frontend (load-balanced traffic).
service.statsPort8404Port for the stats + health endpoint.
service.httpsPort443HTTPS (pod 8443), only with tls.enabled.
tls.enabledfalseAppends 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.enabledfalseRequest a cert-manager Certificate from tls.certManager.issuerRef (2nd choice).
tls.selfSigned.validityDays365Otherwise Helm generates a CA + certificate, kept across upgrades.
serviceAccount.createtrueCreate a ServiceAccount (token automount disabled).
rbac.createfalseCreate an (empty) Role + RoleBinding.
networkPolicy.enabledtrueCreate a NetworkPolicy.
networkPolicy.allowExternaltrueAllow ingress from outside the namespace.
podDisruptionBudget.enabledtrueCreate a PodDisruptionBudget.
podDisruptionBudget.minAvailable1Minimum available pods during disruption.
ingress.enabledfalseCreate 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.servicePortnullBackend 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 emptyDir volumes at /var/lib/haproxy for the pidfile + admin socket and at /tmp).
  • All Linux capabilities dropped; runAsNonRoot enforced via quench-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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the charthaproxy is pinned at v0.0.20 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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