Envoy Gateway Setup
Document Information
Section titled “Document Information”| Item | Details |
|---|---|
| Purpose | Introduce Envoy Gateway in a Dev environment and validate Gateway API-based L7 routing with NodePort external exposure |
| Target Environment | AKS Dev cluster, namespace envoy-gateway |
| Key Versions | Envoy Gateway v1.7.0, Envoy Proxy (distroless) |
| Related Repositories | cluster-init: control plane + Gateway CR, platform-gitops-deploy: per-app HTTPRoute |
Background and Goals
Section titled “Background and Goals”Previously, NGINX Ingress Controller was used for L7 routing based on Ingress resources. Envoy Gateway is an implementation of Kubernetes Gateway API (GatewayClass / Gateway / HTTPRoute), and this work is for coexistence and validation purposes.
What We’re Doing with Envoy Gateway
Section titled “What We’re Doing with Envoy Gateway”- Declare host/path routing using the Gateway API standard (HTTPRoute)
- Deploy the data plane as a DaemonSet scheduled to specific nodes
- Fix external entry points to NodePort (30080/30443) for easy LB/firewall integration
- Apply IP whitelisting via SecurityPolicy
- Detect client IP and control connections via ClientTrafficPolicy
| Included | Excluded |
|---|---|
Install and configure in Dev envoy-gateway namespace | Production rollout |
| GatewayClass + Gateway + EnvoyProxy + policies | Bulk Ingress migration |
| HTTPRoute testing for target apps (nginx-proxy, pgadmin, rabbitmq) | Full-service Gateway API migration |
| SecurityPolicy (IP whitelist) | cert-manager integration, rate limiting |
Architecture
Section titled “Architecture”
Control Plane vs Data Plane
Section titled “Control Plane vs Data Plane”| Role | Description |
|---|---|
| Control Plane | envoy-gateway Deployment, reads Gateway/HTTPRoute and delivers configuration to the data plane via xDS. Does not directly handle user traffic |
| Data Plane | Envoy DaemonSet created per Gateway, receives requests on actual listeners and proxies to upstream |
Traffic Flow
Section titled “Traffic Flow”Client → (LB/VIP or Node IP) → NodePort 30080/30443 → Service (80/443) → Pod targetPort (Envoy listen port, e.g., 10080) → HTTPRoute matching → Backend Service (e.g., nginx-proxy:8080)CRDs Used
Section titled “CRDs Used”| CRD | Role |
|---|---|
GatewayClass | Links to controller, references EnvoyProxy via parametersRef |
Gateway | Defines listeners (HTTP 80, HTTPS 443 TLS Terminate) |
EnvoyProxy | Infrastructure spec: DaemonSet, Service (NodePort), images, etc. |
ClientTrafficPolicy | X-Forwarded-For, HTTP/1.0, bufferLimit |
SecurityPolicy | IP whitelist (CIDR-based) |
HTTPRoute | Host, rules, backendRefs (can be placed in app namespaces) |
Manifests
Section titled “Manifests”GatewayClass
Section titled “GatewayClass”kind: GatewayClassapiVersion: gateway.networking.k8s.io/v1metadata: name: platform-gateway-classspec: controllerName: gateway.envoyproxy.io/gatewayclass-controllerConnecting an EnvoyProxy CR via parametersRef allows control over data plane settings such as DaemonSet/NodePort.
Gateway
Section titled “Gateway”apiVersion: gateway.networking.k8s.io/v1kind: Gatewaymetadata: name: platform-gatewayspec: gatewayClassName: platform-gateway-class listeners: - name: http protocol: HTTP port: 80 allowedRoutes: namespaces: from: All - name: https protocol: HTTPS port: 443 allowedRoutes: namespaces: from: All tls: mode: Terminate certificateRefs: - kind: Secret name: platform-gateway-dummy-tlsKey Points:
allowedRoutes.namespaces.from: All: allows cross-namespace HTTPRoutes. Apps in other namespaces can reference this Gateway as parentRef- TLS: Using a self-signed dummy secret for the Dev environment. Replace with a real certificate for production
ClientTrafficPolicy
Section titled “ClientTrafficPolicy”apiVersion: gateway.envoyproxy.io/v1alpha1kind: ClientTrafficPolicymetadata: name: client-ip-detectionspec: targetRefs: - group: gateway.networking.k8s.io kind: Gateway name: platform-gateway clientIPDetection: xForwardedFor: numTrustedHops: 1 http1: http10: {} connection: bufferLimit: "1024Mi"The numTrustedHops setting is essential for detecting the actual client IP behind a load balancer.
SecurityPolicy (IP Whitelist)
Section titled “SecurityPolicy (IP Whitelist)”apiVersion: gateway.envoyproxy.io/v1alpha1kind: SecurityPolicymetadata: name: ip-whitelistspec: targetRefs: - group: gateway.networking.k8s.io kind: Gateway name: platform-gateway authorization: defaultAction: Deny rules: - action: Allow principal: clientCIDRs: - xxx.xxx.xxx.xxx/32 - xxx.xxx.xxx.yyy/32IP-based access control can be declaratively applied at the Gateway level. This is more structured than the Ingress annotation approach.
Helm Deployment (Kustomize + HelmChart)
Section titled “Helm Deployment (Kustomize + HelmChart)”namespace: envoy-gateway
resources:- ./namespaces.yaml- ./dummy-tls-secret.yaml- ./platform-gateway.yaml
helmGlobals: chartHome: ../../../base/envoy-gateway/charts
helmCharts:- name: gateway-helm-v1.7.0 version: v1.7.0 releaseName: envoy-gateway namespace: envoy-gateway valuesFile: values.yaml includeCRDs: falseCRDs are managed separately (includeCRDs: false), to decouple CRD upgrades from controller upgrades.
Key Helm Values
Section titled “Key Helm Values”| Item | Setting |
|---|---|
| Image | envoyproxy/gateway:v1.7.0 |
| Resources | CPU 100m / Memory 256Mi~1024Mi |
| Security | non-root (UID 65532), seccompProfile RuntimeDefault |
| Service | ClusterIP (control plane), NodePort (data plane) |
| Replicas | 1 (Dev) |
| certgen | TTL 30s, non-root |