aws-alb-gateway

by ducthangqd1998

Helm chartv0.1.3App 0.1.2Apache-2.0Verified publisher

Manage AWS Load Balancer Controller Gateway API resources for EKS.

About this chart

aws-alb-gateway

aws-alb-gateway is a Helm chart for managing Kubernetes Gateway API resources and AWS Load Balancer Controller Gateway resources on EKS.

The chart renders:

  • Gateway
  • LoadBalancerConfiguration
  • TargetGroupConfiguration
  • HTTPRoute
  • Optional ReferenceGrant

It does not install application workloads. Use it to define ALB-backed Gateway API entry points and route existing Kubernetes Services through them.

Overview

AWS Load Balancer Controller can create an Application Load Balancer from a Kubernetes Gateway. Services are attached to that Gateway with Gateway API routes such as HTTPRoute.

This chart supports two gateway modes:

  • shared: attach routes to an existing Gateway. The chart does not create the Gateway.
  • dedicated: create a Gateway, AWS load balancer configuration, optional default target group configuration, and routes.

The default target type is ip through global.defaultTargetType. You can override it globally, per Gateway default target group, or per route target group.

Resource-level labels and annotations always take precedence over global.labels and global.annotations without emitting duplicate YAML keys.

Prerequisites

Before installing this chart, the cluster should have:

  • Kubernetes Gateway API CRDs installed.
  • AWS Load Balancer Controller installed with Gateway API support.
  • AWS Load Balancer Controller Gateway CRDs installed.
  • A GatewayClass matching global.gatewayClassName. The default is alb.
  • Valid AWS permissions and infrastructure configuration for ALB provisioning.
  • ACM certificates when using HTTPS listeners with certificateArn.

Install

Example values are available in:

  • examples/shared-gateway-values.yaml
  • examples/dedicated-gateway-values.yaml
  • examples/multi-gateway-values.yaml

Render the chart:

helm template my-gateway ./charts/aws-alb-gateway \
  -f ./charts/aws-alb-gateway/examples/shared-gateway-values.yaml

Install or upgrade:

helm upgrade --install my-gateway ./charts/aws-alb-gateway \
  --namespace gateway-system \
  --create-namespace \
  -f ./charts/aws-alb-gateway/examples/shared-gateway-values.yaml

Verify the rendered resources:

kubectl get gateway,httproute,referencegrant,targetgroupconfiguration,loadbalancerconfiguration -A
kubectl describe gateway -n gateway-system shared-gateway
kubectl describe httproute -n example-app example-app

Shared Gateway Example

Use shared mode when the Gateway already exists and this release should only manage routes, optional ReferenceGrants, and optional service target group configuration.

global:
  gatewayClassName: alb
  defaultTargetType: ip

gateways:
  shared:
    enabled: true
    mode: shared
    name: shared-gateway
    namespace: gateway-system
    sectionName: https

routes:
  example-api:
    enabled: true
    gateway: shared
    namespace: gateway-system
    name: example-api
    hostnames:
      - api.example.org
    rules:
      - matches:
          - path:
              type: PathPrefix
              value: /
        backendRefs:
          - name: example-api
            namespace: example-api
            port: 8080
    targetGroup:
      enabled: true
      healthCheck:
        path: /ready
        protocol: HTTP
        port: traffic-port
        matcher:
          httpCode: "200"
    referenceGrant:
      enabled: true
  • Cross-namespace HTTPRoute -> Gateway attachment: When the route namespace differs from the Gateway namespace, the chart adds the Gateway namespace to HTTPRoute.spec.parentRefs. Cross-namespace route attachment is authorized on the Gateway listener via allowedRoutes.namespaces.
  • Cross-namespace HTTPRoute -> Service routing (ReferenceGrant): When routes.<key>.referenceGrant.enabled=true and a route references backend Services in another namespace (backendRefs[].namespace != routes.<key>.namespace), or when referenceGrant.namespace is set explicitly, the chart renders a ReferenceGrant in the target backend namespace allowing HTTPRoute from the route's namespace to reference the target Service.

Dedicated Gateway Example

Use dedicated mode when this chart should create the Gateway and its AWS load balancer configuration.

global:
  gatewayClassName: alb
  defaultTargetType: ip

gateways:
  edge:
    enabled: true
    mode: dedicated
    name: edge-gateway
    namespace: gateway-system
    sectionName: https
    listeners:
      - name: https
        protocol: HTTPS
        port: 443
        hostname: app.example.org
        certificateArn: arn:aws:acm:us-east-1:111122223333:certificate/replace-me
        allowedRoutes:
          namespaces:
            from: Same
    loadBalancer:
      scheme: internet-facing
      ipAddressType: ipv4
      tags:
        Environment: example
        ManagedBy: helm
      loadBalancerAttributes:
        - key: deletion_protection.enabled
          value: "true"
    defaultTargetGroup:
      enabled: true
      targetType: ip
      protocol: HTTP
      protocolVersion: HTTP1
      healthCheck:
        path: /healthz
        protocol: HTTP
        port: traffic-port
        matcher:
          httpCode: "200"

routes:
  example-app:
    enabled: true
    gateway: edge
    namespace: gateway-system
    name: example-app
    hostnames:
      - app.example.org
    rules:
      - matches:
          - path:
              type: PathPrefix
              value: /
        backendRefs:
          - name: example-app
            port: 80
    targetGroup:
      enabled: false

When listeners[].certificateArn is set, the chart adds a matching listenerConfigurations[].defaultCertificate entry to the LoadBalancerConfiguration. You can also provide Gateway API TLS settings directly with listeners[].tls or listeners[].certificateRefs.

Rendered Resources

Shared Gateway mode renders:

  • Enabled HTTPRoute resources.
  • Service-level TargetGroupConfiguration resources when routes.<key>.targetGroup.enabled=true.
  • ReferenceGrant resources in target backend namespaces when routes.<key>.referenceGrant.enabled=true and cross-namespace backendRefs (or referenceGrant.namespace) are configured.

Shared Gateway mode does not render a Gateway.

Dedicated Gateway mode renders:

  • Gateway.
  • LoadBalancerConfiguration when load balancer settings are set or default target group configuration is enabled.
  • Default TargetGroupConfiguration when gateways.<key>.defaultTargetGroup.enabled=true.
  • Enabled HTTPRoute resources.
  • Service-level TargetGroupConfiguration resources when enabled.
  • ReferenceGrant resources when enabled for cross-namespace backend references.

Naming

Default names are generated as follows:

ResourceDefault name
Gatewaygateways.<key>.name, or <key>
LoadBalancerConfiguration<gateway-name>-lbcfg
Default TargetGroupConfiguration<gateway-name>-default-tgc
HTTPRouteroutes.<key>.name, or <key>
Route TargetGroupConfiguration<route-name>-tgc
ReferenceGrant<route-name>-allow-<route-namespace>

All generated names are truncated to 63 characters.

Configuration

Global Values

ValueDescriptionDefault
nameOverrideOverride chart name used in resource labels.""
fullnameOverrideOverride full release name helper.""
global.gatewayClassNameDefault GatewayClass for dedicated Gateways.alb
global.defaultTargetTypeDefault target type for target group configuration. Valid values are ip and instance.ip
global.labelsDefault labels added to chart-managed resources (overridden by local labels).{}
global.annotationsDefault annotations added to chart-managed resources (overridden by local annotations).{}

Gateway Values

ValueDescription
gateways.<key>.enabledEnables or disables the Gateway definition.
gateways.<key>.modeGateway mode. Valid values are shared and dedicated.
gateways.<key>.nameGateway name. Required for shared; optional for dedicated.
gateways.<key>.namespaceNamespace for the Gateway and Gateway-level AWS resources.
gateways.<key>.gatewayClassNameGatewayClass override for a dedicated Gateway.
gateways.<key>.sectionNameDefault listener section name used by routes.
gateways.<key>.labelsAdditional labels for the dedicated Gateway (overrides global.labels).
gateways.<key>.annotationsAdditional annotations for the dedicated Gateway (overrides global.annotations).
gateways.<key>.listenersGateway listeners. Required for dedicated. Supports HTTP and HTTPS.
gateways.<key>.loadBalancerAWS LoadBalancerConfiguration settings.
gateways.<key>.defaultTargetGroupDefault AWS TargetGroupConfiguration referenced by the load balancer configuration.

Common loadBalancer fields:

ValueDescription
loadBalancer.nameOverride LoadBalancerConfiguration resource name.
loadBalancer.labelsAdditional labels for LoadBalancerConfiguration.
loadBalancer.annotationsAdditional annotations for LoadBalancerConfiguration.
loadBalancer.loadBalancerNameAWS load balancer name.
loadBalancer.schemeALB scheme, for example internet-facing or internal.
loadBalancer.ipAddressTypeIP address type, for example ipv4 or dualstack.
loadBalancer.securityGroupsSecurity groups for the load balancer.
loadBalancer.manageBackendSecurityGroupRulesLet AWS LBC manage backend security group rules (true / false).
loadBalancer.subnetsSubnet identifiers. Rendered as loadBalancerSubnets.
loadBalancer.loadBalancerSubnetsFull load balancer subnet entries.
loadBalancer.loadBalancerSubnetsSelectorSelector for load balancer subnets.
loadBalancer.tagsAWS tags.
loadBalancer.wafV2WAFv2 configuration.
loadBalancer.shieldShield configuration.
loadBalancer.loadBalancerAttributesALB attributes.
loadBalancer.listenerConfigurationsListener configuration entries.
loadBalancer.minimumLoadBalancerCapacityMinimum load balancer capacity settings.
loadBalancer.mergingModeConfiguration merging mode.

Route Values

ValueDescription
routes.<key>.enabledEnables or disables the route.
routes.<key>.gatewayGateway key to attach the route to.
routes.<key>.namespaceNamespace for the HTTPRoute and default route-level target group configuration.
routes.<key>.nameHTTPRoute name. Defaults to the route key.
routes.<key>.labelsAdditional labels for the HTTPRoute (overrides global.labels).
routes.<key>.annotationsAdditional annotations for the HTTPRoute (overrides global.annotations).
routes.<key>.hostnamesHTTPRoute.spec.hostnames.
routes.<key>.parentRefs.refsFull override for HTTPRoute.spec.parentRefs.
routes.<key>.parentRefs.sectionNameListener section override for the default parent reference.
routes.<key>.rulesRaw Gateway API HTTPRoute.spec.rules. Each rule must include backendRefs or filters.
routes.<key>.targetGroupOptional service-level TargetGroupConfiguration.
routes.<key>.referenceGrantOptional ReferenceGrant configuration for cross-namespace HTTPRoute -> Service backend references.

Common referenceGrant fields:

ValueDescriptionDefault
referenceGrant.enabledRender ReferenceGrant for cross-namespace backend references.false
referenceGrant.apiVersionAPI version for ReferenceGrant.gateway.networking.k8s.io/v1beta1
referenceGrant.nameCustom ReferenceGrant resource name.<route-name>-allow-<route-namespace>
referenceGrant.namespaceExplicit target namespace (auto-detected from cross-namespace backendRefs[].namespace when omitted).""
referenceGrant.serviceNameOptional target Service name when referenceGrant.namespace is set explicitly.""
referenceGrant.fromOverride ReferenceGrant.spec.from.HTTPRoute in routes.<key>.namespace
referenceGrant.toOverride ReferenceGrant.spec.to.Cross-namespace Services (or group: "", kind: Service)
referenceGrant.labelsAdditional labels for ReferenceGrant.{}
referenceGrant.annotationsAdditional annotations for ReferenceGrant.{}

TargetGroupConfiguration

gateways.<key>.defaultTargetGroup and routes.<key>.targetGroup share the same configuration shape.

targetGroup:
  enabled: true
  targetType: ip
  targetGroupName: optional-target-group-name
  protocol: HTTP
  protocolVersion: HTTP1
  ipAddressType: ipv4
  enableMultiCluster: false
  targetControlPort: 8080
  targetGroupAttributes:
    - key: deregistration_delay.timeout_seconds
      value: "30"
  tags:
    ManagedBy: helm
  nodeSelector:
    matchLabels:
      nodepool: example
  targetReference:
    kind: Service
    name: example-app
  healthCheck:
    path: /healthz
    protocol: HTTP
    port: traffic-port
    interval: 15
    timeout: 5
    healthyThresholdCount: 2
    unhealthyThresholdCount: 2
    matcher:
      httpCode: "200"

Short health check fields are converted to AWS Load Balancer Controller field names:

Input fieldRendered field
pathhealthCheckPath
porthealthCheckPort
protocolhealthCheckProtocol
intervalhealthCheckInterval
timeouthealthCheckTimeout

If routes.<key>.targetGroup.targetReference.name is omitted, the chart automatically selects the first backendRefs[0].name from the first route rule that defines backendRefs (safely skipping filter-only rules such as HTTP-to-HTTPS redirects).

Deploy aws-alb-gateway with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has aws-alb-gateway 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 chartaws-alb-gateway is pinned at v0.1.3 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