Guide to enable and configure Cilium Gateway API, install Gateway API CRDs, create Gateway and HTTPRoute resources, deploy demo services, and test routing for multiple host and path backends
This guide shows how to enable Gateway API support in Cilium, install the required Gateway API CRDs, enable the feature in the Cilium Helm chart, and configure a Gateway + HTTPRoute to expose multiple apps (shopping.com and blogger.com) plus a default backend.
Cilium expects the experimental Gateway API CRDs in many environments because they include TCPRoute/TLSRoute/UDPRoute support. Install the experimental release to avoid missing-CRD errors.Install the experimental Gateway API CRDs (example):
Cilium requires either nodePort.enabled=true (Cilium NodePort implementation) or kubeProxyReplacement=true. This prerequisite is also required when enabling ingress support in Cilium. Pick one of these two options in your Helm values.
Update Cilium Helm values to enable Gateway API support. Example snippet from values.yaml:
Copy
# enable Channel: either enable NodePort or kube-proxy replacementnodePort: enabled: true# orgatewayAPI: # Enable support for Gateway API in cilium enabled: false enableProxyProtocol: false enableAppProtocol: false # ... other gatewayAPI options ...
To enable Gateway API (and optionally enable kube-proxy replacement), run:
This demo deploys three apps and a default catch-all backend:
App / Host
Routes
Service name
Service port
shopping.com
/products -> ecom-products
ecom-products-service
3000
shopping.com
/cart -> ecom-carts
ecom-carts-service
3000
blogger.com
/ -> blog
blog-service
3000
catch-all
all unmatched -> default-backend
default-backend-service
80
Apply the following YAML manifests in your cluster (examples below). Each block contains a Deployment + ClusterIP Service.ecom-products deployment + service:
NAME CLASS ADDRESS PROGRAMMED AGEmy-gateway cilium 172.19.255.92 True 10s
When the Gateway is created, Cilium automatically creates a LoadBalancer-type Service named cilium-gateway-<gateway-name>. That Service exposes an EXTERNAL-IP you can point DNS at:
Copy
kubectl get svc
Example snippet:
Copy
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)cilium-gateway-my-gateway LoadBalancer 10.96.161.102 172.19.255.92 80:30269/TCP
Use that EXTERNAL-IP (172.19.255.92 in the example) for DNS records or /etc/hosts entries when testing.
Example snippet from the default nginx page (trimmed):
Copy
<!DOCTYPE html><html><head><title>Welcome to nginx!</title><style>html { color-scheme: light dark; }body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; }</style></head><body><p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.</p><p><em>Thank you for using nginx.</em></p></body></html>
Seeing the correct JSON responses and the nginx default page confirms that the Gateway + HTTPRoute configuration is forwarding traffic as expected.