Network: Gateway API (Traefik)
What is the Kubernetes Gateway API?
The Kubernetes Gateway API is the next-generation standard for service networking in Kubernetes, superseding the Ingress resource. It introduces role-oriented resources (GatewayClass, Gateway, HTTPRoute, GRPCRoute, etc.) that cleanly separate infrastructure operations (defining listening ports and TLS certificates) from application routing (defining paths, headers, and target services).
kubara supports Gateway API alongside traditional Ingress. When configured with Traefik, Traefik functions as both the Gateway controller and Ingress controller simultaneously.
Architecture & Dual-Provider Operation
When Gateway API is enabled:
- Traefik runs both providers in parallel:
providers.kubernetesGateway: Watches and reconcilesGatewayandHTTPRouteresources.-
providers.kubernetesIngress&providers.kubernetesCRD: Remain active so non-migrated endpoints (such ascert-managerHTTP-01 challenge ingresses, OpenBao ingress, and Traefik dashboardIngressRouteat/traefik) continue to function without interruption. -
Automated TLS provisioning:
- Traefik provisions a cert-manager
Certificate(traefik-gateway-tls) for the Gateway's HTTPS listener. -
The listener references
traefik-gateway-tlsincertificateRefs, which is also set as Traefik'stlsStore.default.defaultCertificate. -
Cross-Namespace Route Attachment:
-
The HTTPS listener is configured with
allowedRoutes.namespaces.from: All, enablingHTTPRouteresources across any namespace (argocd,traefik, monitoring, or application workloads) to attach to the central Gateway. -
Namespace-Local ForwardAuth Middlewares:
- In Gateway API,
HTTPRoutefilter references (ExtensionRef) are restricted to local object references (LocalObjectReference) and cannot span across namespaces. -
To support OAuth2 Proxy authentication, kubara renders a namespace-local
<release>-gateway-authMiddlewareinto each service's namespace (andargocd-gateway-authinargocd), referencing the central OAuth2 Proxy service. -
Automatic DNS Synchronization:
- ExternalDNS is automatically configured with
--source=gateway-httproute, inspecting hostnames defined onHTTPRouteresources and syncing DNS records with your cloud provider.
Configuration in config.yaml
To enable Gateway API on your cluster, configure the .cluster.networking block in config.yaml:
clusters:
- name: my-cluster
stage: dev
dnsName: my-cluster.example.com
networking:
type: gateway # selects Gateway API ("ingress" or "gateway")
gateway:
name: traefik # name of the Gateway resource
namespace: traefik # namespace where Traefik is deployed
sectionName: websecure # listener section (defaults to websecure)
services:
traefik:
status: enabled
cert-manager:
status: enabled
oauth2-proxy:
status: enabled
Configuration Options
| Field | Type | Description |
|---|---|---|
networking.type |
string | ingress (default) or gateway. Sets the active routing API for catalog templates. |
networking.ingress.className |
string | Ingress class name (defaults to traefik). Used when type: ingress. |
networking.gateway.name |
string | Name of the parent Gateway resource. Required when type: gateway. |
networking.gateway.namespace |
string | Namespace of the parent Gateway resource (must be traefik for the bundled Traefik setup). |
networking.gateway.sectionName |
string | Optional listener name on the Gateway (defaults to websecure). |
Service-Level Overrides
Individual services can override the cluster Gateway reference or add custom routing annotations under services.<service>.networking:
services:
custom-service:
status: enabled
networking:
gateway:
name: custom-gateway
namespace: custom-namespace
sectionName: https
annotations:
custom.annotation/key: "value"
A service-level gateway override completely replaces the cluster Gateway reference for that service and requires networking.type: gateway.
Workflow & Deployment
-
Update
config.yaml: Setnetworking.type: gatewaywith the correspondinggatewayblock. -
Generate platform manifests: Run
kubara generateto re-render Helm values and manifests:kubara generate -
Review generated artifacts:
- In
platform-configs/<cluster>/helm/traefik/values.generated.yaml, verify thatproviders.kubernetesGateway.enabled: trueand thegatewayblock are rendered. -
In platform services (
argo-cd,homer-dashboard,kube-prometheus-stack,longhorn,kyverno-policy-reporter,oauth2-proxy), verify thatingress.enabled: falseandgatewayRoutes/httprouteare generated. -
Deploy via GitOps: Commit and push your changes. Argo CD will synchronize:
- Gateway API Standard CRDs (installed via
bootstrap-crds). - Traefik Gateway, listeners, and certificates.
HTTPRouteresources attaching to the Gateway.