January 28, 2025

Kubernetes Gateway API with Contour

This guide walks you through installing the Gateway API CRDs, deploying Contour using Helm with the Gateway API enabled, creating a GatewayClass, updating the Contour ConfigMap, and restarting the Contour deployment.

Prerequisites:

Steps

Install Gateway API CRDs

kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml

This command applies the necessary Custom Resource Definitions (CRDs) for the Gateway API to your cluster.

Install Contour using Helm

helm upgrade --install contour contour \
  --repo https://charts.bitnami.com/bitnami \
  --set fullnameOverride=gateway \
  --namespace projectcontour --create-namespace \
  --set contour.ingressClass.create=true \
  --set contour.ingressClass.name=contour \
  --set gateway.enabled=true \
  --set gateway.installCRDs=true

Explanation of Flags:

Create a GatewayClass

kubectl apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
  name: contour
spec:
  controllerName: projectcontour.io/gateway-controller
EOF

This creates a GatewayClass named “contour” that tells Kubernetes to use Contour’s Gateway controller for handling Gateways of this class. The controllerName is crucial for linking the GatewayClass to the Contour controller.

Update the Contour ConfigMap

kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
  name: contour
  namespace: projectcontour
data:
  contour.yaml: |
    gateway:
      controllerName: projectcontour.io/gateway-controller
EOF

This step configures Contour to be the controller for the gateway. It’s very important to ensure Contour processes the Gateway API resources. It explicitly sets the controllerName within Contour’s configuration.

Restart Contour Deployment

kubectl -n projectcontour rollout restart deployment/gateway-contour

This restarts the Contour deployment to apply the configuration changes to the ConfigMap. This ensures that Contour picks up the new controllerName setting.

Verification

After completing these steps, you can verify the setup by:

© Nataraj Basappa 2025