🎉 DevOps Interview Prep Bundle is live — 1000+ Q&A across 20 topicsGet it →
All Articles

Nginx vs Caddy vs HAProxy — Best Load Balancer for Kubernetes 2026

Choosing between Nginx, Caddy, and HAProxy as your Kubernetes load balancer or ingress? Here's a practical comparison covering performance, configuration, TLS, and when to use each.

DevOpsBoysMay 30, 20264 min read
Share:Tweet

Three battle-tested load balancers. Three different design philosophies. Choosing the wrong one for your use case means config complexity you'll regret.

Here's the honest breakdown.


Quick Summary

NginxCaddyHAProxy
Best forGeneral HTTP, static filesAuto HTTPS, simple setupHigh-performance TCP/HTTP
Config complexityMediumLowHigh
Auto TLSVia cert-managerBuilt-inManual
PerformanceHighGoodVery High
Memory usageLowMediumVery Low
Dynamic configWith Plus (paid) or Nginx IngressVia APIVia runtime API
CommunityMassiveGrowingLarge

Nginx

As a Kubernetes Ingress Controller

Nginx Ingress Controller is the most deployed ingress in Kubernetes. Stable, well-documented, works everywhere.

bash
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install ingress-nginx ingress-nginx/ingress-nginx \
  --set controller.replicaCount=2 \
  --set controller.resources.requests.cpu=100m \
  --set controller.resources.requests.memory=90Mi

Key features:

  • Path-based and host-based routing
  • Rate limiting via annotations
  • Auth (basic, LDAP, OAuth via auth-url)
  • Canary deployments with traffic splitting
  • WebSocket support
yaml
# Nginx Ingress with rate limiting and canary
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: api-ingress
  annotations:
    nginx.ingress.kubernetes.io/limit-rps: "100"
    nginx.ingress.kubernetes.io/canary: "true"
    nginx.ingress.kubernetes.io/canary-weight: "10"
spec:
  ingressClassName: nginx
  rules:
    - host: api.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: api-service
                port:
                  number: 80

Performance

Nginx handles 50,000+ concurrent connections on modest hardware. Worker processes = CPU cores. Memory per worker: ~2–3MB under load.

When to use Nginx

  • You need a mature, battle-tested ingress with a huge community
  • You need advanced traffic routing (canary, auth, rate limiting)
  • You're running medium-to-high traffic HTTP workloads
  • Your team already knows Nginx

Downside

  • TLS requires cert-manager setup (extra complexity)
  • Config tuning for high performance requires nginx.conf knowledge
  • Nginx Plus (commercial) needed for some enterprise features

Caddy

The simplest TLS setup you'll ever configure

Caddy's killer feature: automatic HTTPS with zero configuration. It handles Let's Encrypt cert issuance and renewal automatically.

# Caddyfile — this is the ENTIRE config
api.example.com {
    reverse_proxy api-service:8080
}

app.example.com {
    reverse_proxy app-service:3000
}

That's it. HTTPS just works.

As a Kubernetes Ingress (via Ingress Controller)

bash
# No official Caddy Ingress Controller — use this community one:
# https://github.com/caddyserver/ingress
 
helm install caddy-ingress \
  oci://ghcr.io/caddyserver/charts/caddy-ingress-controller

JSON API for Dynamic Config

Caddy has a REST API for dynamic configuration — no reload needed:

bash
# Add a new route without restart
curl -X POST http://localhost:2019/config/apps/http/servers/srv0/routes \
  -H "Content-Type: application/json" \
  -d '{
    "match": [{"host": ["new-app.example.com"]}],
    "handle": [{"handler": "reverse_proxy", "upstreams": [{"dial": "new-service:8080"}]}]
  }'

Performance

Caddy is written in Go. Fast enough for most production workloads. Slightly higher memory than Nginx (~50–100MB base) but the auto-TLS overhead is worth it for most teams.

When to use Caddy

  • Small-to-medium teams who want HTTPS without cert-manager complexity
  • Rapid prototyping and staging environments
  • When developer experience is more important than micro-optimization
  • Internal tooling that needs HTTPS

Downside

  • Less mature as a Kubernetes ingress than Nginx
  • Less community resources/Stack Overflow answers
  • Not ideal for very high traffic (100K+ RPS)

HAProxy

The performance king

HAProxy is the fastest load balancer in this comparison. It's used by GitHub, Instagram, and Stack Overflow. Pure C implementation, minimal memory footprint, handles millions of connections.

In Kubernetes

HAProxy Ingress Controller:

bash
helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts
helm install haproxy-ingress haproxy-ingress/haproxy-ingress

The Runtime API — Zero Downtime Updates

HAProxy's runtime API lets you modify config without restart:

bash
# Add backend server without reload
echo "add server mybackend/server3 192.168.1.13:8080" | \
  socat stdio /var/run/haproxy/admin.sock
 
# Check server status
echo "show servers state mybackend" | \
  socat stdio /var/run/haproxy/admin.sock

TCP Load Balancing — Where HAProxy Shines

For non-HTTP protocols (database proxying, MQTT, custom TCP), HAProxy is the clear winner:

# haproxy.cfg — TCP mode for PostgreSQL
frontend postgres_front
    bind *:5432
    mode tcp
    default_backend postgres_back

backend postgres_back
    mode tcp
    balance roundrobin
    server pg1 192.168.1.10:5432 check
    server pg2 192.168.1.11:5432 check backup

Performance Numbers

Requests/secNginxCaddyHAProxy
HTTP/1.180K60K120K
Memory (idle)5MB50MB3MB
Connections (max)50K40K500K+

Approximate — varies significantly by hardware and config

When to use HAProxy

  • Very high traffic (100K+ RPS)
  • TCP load balancing (databases, message queues)
  • Environments where memory and CPU efficiency are critical
  • You need the most granular control over load balancing algorithms

Downside

  • Config syntax is complex
  • TLS setup requires more work than Caddy
  • Less intuitive than Nginx for HTTP use cases

Production Decision Guide

Starting a new Kubernetes cluster? → Nginx Ingress Controller — best docs, most examples, works for 95% of cases.

Small team, want HTTPS to just work? → Caddy — fewer moving parts, less ops work.

Database/TCP load balancing? → HAProxy — designed for exactly this.

High-traffic production (100K+ RPS)? → HAProxy or Nginx with tuned config.

Microservices with service mesh? → Consider Envoy-based solutions (Istio, Contour) instead — they integrate with service mesh better.


For most Kubernetes deployments in 2026, Nginx Ingress Controller is the safe default. Caddy is underrated for teams that want simplicity. HAProxy is the specialist tool for specific high-performance needs.

Practice ingress configuration on real Kubernetes clusters at KodeKloud.

🔧

Today I Fixed

Short real fixes from production — posted daily

Browse fixes
Newsletter

Stay ahead of the curve

Get the latest DevOps, Kubernetes, AWS, and AI/ML guides delivered straight to your inbox. No spam — just practical engineering content.

Related Articles

Comments