Skip to content

Configure an L7 load balancer

After completing this guide, UDS Core will work correctly behind an L7 load balancer such as AWS Application Load Balancer (ALB) or Azure Application Gateway. This involves configuring external TLS termination, trusted proxy settings, and optionally client certificate forwarding.

  • UDS CLI installed
  • Access to a Kubernetes cluster with prerequisites met
  • An L7 load balancer (AWS ALB, Azure Application Gateway, or similar) provisioned
  1. Configure your UDS Bundle with L7 overrides

    Add the necessary overrides to your UDS Core bundle configuration. This disables HTTPS redirects (since the L7 load balancer terminates TLS before traffic reaches Istio) and sets the trusted proxy count:

    uds-bundle.yaml
    kind: UDSBundle
    metadata:
    name: my-uds-core
    description: UDS Core behind an L7 load balancer
    version: "0.1.0"
    packages:
    - name: core
    repository: registry.defenseunicorns.com/public/core
    ref: x.x.x-upstream
    overrides:
    istio-tenant-gateway:
    uds-istio-config:
    values:
    - path: tls.servers.keycloak.enableHttpsRedirect
    value: false
    - path: tls.servers.tenant.enableHttpsRedirect
    value: false
    # Uncomment if admin gateway is also behind the L7 load balancer:
    # istio-admin-gateway:
    # uds-istio-config:
    # values:
    # - path: tls.servers.keycloak.enableHttpsRedirect
    # value: false
    # - path: tls.servers.admin.enableHttpsRedirect
    # value: false
    istio-controlplane:
    istiod:
    values:
    # Set to the number of proxies in front of Istio (e.g., 1 for a single ALB)
    - path: meshConfig.defaultConfig.gatewayTopology.numTrustedProxies
    value: 1
  2. Configure client certificate forwarding (if using mTLS)

    If your L7 load balancer performs mutual TLS and forwards client certificates to Keycloak (e.g., for DoD CAC authentication), configure Keycloak to read the certificate from the correct header:

    uds-bundle.yaml
    overrides:
    keycloak:
    keycloak:
    values:
    - path: thirdPartyIntegration.tls.tlsCertificateHeader
    # AWS ALB uses this header for client certificates
    value: "x-amzn-mtls-clientcert"
    - path: thirdPartyIntegration.tls.tlsCertificateFormat
    # "AWS" for ALB, "PEM" for load balancers that forward standard PEM
    value: "AWS"
  3. Create and deploy your bundle

    Terminal window
    uds create --confirm && uds deploy uds-bundle-*.tar.zst --confirm
  4. Route the load balancer to the Istio gateway

    Configure your L7 load balancer to forward traffic to the Istio ingress gateway service. The exact steps vary by cloud provider and infrastructure setup:

    • AWS ALB: Create a target group pointing at the Network Load Balancer (NLB) or NodePort provisioned by the tenant-ingressgateway service in istio-tenant-gateway, then attach that target group to the ALB listener.
    • Azure Application Gateway: Configure a backend pool targeting the Istio gateway service’s external IP or node ports.

    Verify the gateway service is available:

    Terminal window
    uds zarf tools kubectl get svc -n istio-tenant-gateway tenant-ingressgateway

    The EXTERNAL-IP or PORT(S) shown will be the target for your load balancer’s backend configuration.

  • Access an application through the load balancer URL and confirm it loads without redirect loops
  • Verify Keycloak SSO works end-to-end by logging in through the tenant gateway
  • If using mTLS, verify client certificate-based authentication works through Keycloak

Symptoms: Browser shows “too many redirects” or ERR_TOO_MANY_REDIRECTS.

Solution: Verify that HTTPS redirects are disabled for all gateway servers behind the load balancer. For the tenant gateway, both tls.servers.keycloak.enableHttpsRedirect and tls.servers.tenant.enableHttpsRedirect must be set to false. For the admin gateway, use tls.servers.keycloak.enableHttpsRedirect and tls.servers.admin.enableHttpsRedirect. If the admin gateway is also behind the L7 load balancer, disable redirects there too.

Symptoms: Applications see the load balancer’s IP instead of the client’s IP; rate limiting or IP-based access control doesn’t work correctly.

Solution: Verify numTrustedProxies is set to the correct number of proxy hops between the client and Istio. If too low, Istio doesn’t trust the X-Forwarded-For header; if too high, clients could spoof their IP.

Symptoms: Client certificate authentication fails through the load balancer but works when connecting directly to Istio.

Solution:

  • Verify the tlsCertificateHeader matches the header your load balancer uses to forward the certificate
  • Verify the tlsCertificateFormat matches your load balancer’s format (AWS for ALB, PEM for others)
  • Ensure the load balancer is configured to forward client certificates

These guides and concepts may be useful to explore next: