New Delhi, India
ProjectsMay 1, 2025

Zero-Downtime Migration from ingress-nginx to Envoy Gateway v1.7.0

Envoy Gateway
Gateway API
Kubernetes
Helm
Traffic Engineering
Zero-Downtime Migration from ingress-nginx to Envoy Gateway v1.7.0
As ingress-nginx approaches legacy status and the Kubernetes Gateway API becomes the cloud-native standard, migrating live enterprise traffic to Envoy Gateway requires precision. This was not a simple helm upgrade; it was an architectural overhaul involving:
  • Deploying Envoy Gateway v1.7.0 from scratch via FluxCD GitOps
  • Translating legacy NGINX annotations into native Gateway API routes and custom Envoy CRDs
  • Unblocking deployment rollouts past strict Azure Policy / Gatekeeper admission controls
  • Re-architecting CORS enforcement from backend services to the cluster edge
  • Diagnosing complex post-migration bottlenecks across Azure Blob Storage, OpenSearch, and Schema Registry
The cutover was executed with zero service downtime and zero dropped requests across the entire microservice ecosystem.
Zero-Downtime ingress-nginx to Envoy Gateway Migration Architecture
The rollout was codified using FluxCD GitOps (Kustomization and HelmRelease) into the envoy-gateway-system namespace. The deployment established:
  • A standardized GatewayClass managed by the Envoy Gateway control plane
  • A shared ite-gateway resource configured with dual HTTP (port 80) and HTTPS (port 443) listeners
  • A global HTTP-to-HTTPS redirect rule enforcing TLS encryption across all incoming traffic
To support advanced traffic shaping and custom Envoy filters, extensionApis was explicitly enabled in the Envoy Gateway Helm values: This instructed the Envoy Gateway control plane to watch and reconcile extension Custom Resource Definitions (CRDs), specifically EnvoyPatchPolicy, ClientTrafficPolicy, and SecurityPolicy. Before migrating workloads, LoadBalancer IP allocation on Azure was verified, ensuring external DNS records mapped correctly without IP conflicts or routing loops.
During initial bootstrapping in the hardened cluster, zero pods reached the Running state in envoy-gateway-system. Flux reconciliation entered an infinite retry loop, and Helm threw:
Error: another operation (install/upgrade/rollback) is in progress
Inspecting the pre-install hook job using kubectl describe job envoy-gateway-gateway-helm-certgen revealed the blocker: Azure Policy (validation.gatekeeper.sh) intercepted and rejected the hook container because it lacked explicit CPU and memory resource requests and limits. The job timed out after 5 minutes, leaving the Helm release permanently locked in pending-install. Once the hook failed, the main deployment also encountered ReplicaFailure for the exact same compliance reason. The v1.7.0 chart introduced a new schema hierarchy. Resource limits were injected for both the certgen hook job and the core envoyGateway deployment: To recover from the locked state without tearing down the namespace:
  1. Deleted the stuck Helm secret: kubectl delete secret -n envoy-gateway-system -l owner=helm,status=pending-install
  2. Removed failed hook jobs: kubectl delete job envoy-gateway-gateway-helm-certgen -n envoy-gateway-system
  3. Triggered immediate Flux reconciliation:
Controller logs verified that the gateway-api, xds, infrastructure, admin, and metrics runners initialized cleanly. The data-plane proxy log threw a warning:
Expected cgroup v1 files not accessible
By analyzing the node-level runtime security posture, I verified this warning was completely benign in hardened Azure Kubernetes nodes where host /sys/fs/ access is restricted.
Legacy ingress configurations embedded inside individual Helm charts (ite-bff, ite-context, grafana, schema-registry, etc.) were disabled. Each was translated into a declarative HTTPRoute manifest targeting ite-gateway. (For a companion conceptual walkthrough on weighted canary traffic splitting and dual-controller coexistence during this transition, read Kubernetes Ingress Migration: Moving to Envoy Gateway Without Dropping Requests): The application handled large OAuth tokens and enterprise metadata headers, which had previously relied on NGINX buffer tuning:
  • large-client-header-buffers: "4 512k"
  • client-header-buffer-size: "512k"
  • proxy-busy-buffers-size: "512k"
Because the standard Gateway API spec lacks native buffer size parameters, I authored an EnvoyPatchPolicy using JSONPatch syntax to directly configure Envoy's listener filter chain:
With traffic actively routed through Envoy Gateway:
  1. Ingress Audit: Executed a cluster-wide audit (kubectl get ingress -A) to verify no workloads depended on the legacy controller.
  2. Manifest Removal: Deleted deprecated NGINX ingress resources and chart values across all Git repositories.
  3. Controller Teardown: Decommissioned the ingress-nginx controller, its associated LoadBalancer service, and its validating admission webhook configurations, eliminating resource waste and admission latency.
Under the legacy setup, nginx.ingress.kubernetes.io/enable-cors: "false" was configured, effectively bypassing the proxy and delegating CORS preflight handling directly to the backend BFF. With Envoy Gateway, we shifted CORS handling left to the edge using a SecurityPolicy CRD attached directly to the HTTPRoute: Frontend developers running locally on http://localhost:5173 encountered preflight CORS blocks when issuing GraphQL requests against the development cluster (https://api.ite-dev.example.com/graphql). The initial fix failed because the Kustomize patch attempted to modify only index /0 of allowOrigins. I resolved this by patching the entire array strictly inside the development overlay, keeping higher environments secure: This guaranteed that localhost origins were strictly forbidden from ever leaking into QA, UAT, or Production manifests. Developers reported that file uploads (FileUploadDialog.vue PUT requests) continued failing CORS preflight even after Envoy CORS policies were active. By inspecting browser network traces, I isolated the issue:
  • File uploads did not route through Envoy Gateway.
  • Clients obtained a short-lived Shared Access Signature (SAS) token and uploaded files directly to cloud blob storage (https://<storage-account>.blob.core.regulated-cloud.internal).
  • The storage account's Blob service had an exact-match protocol mismatch: it had been configured for https://localhost:5173 instead of http://localhost:5173.
Correcting the protocol on the Azure storage account resolved the upload failures without weakening Envoy edge policies.
  • Observation: kubectl get envoypatchpolicy -A displayed Accepted: True, but Programmed: False with reason ResourceNotFound.
  • Diagnosis: The http listener patch applied cleanly. The https-apex listener was reported as missing because the Dev environment did not yet have active TLS secrets or routes attached to that listener. Once routes were bound, status flipped to Programmed: True.
  • Observation: Queries to OpenSearch returned 500 Internal Server Error.
  • Diagnosis: Audited the Envoy data-plane JSON access logs:
Because Envoy logged healthy 200 responses for the edge hop and verified upstream transport integrity, Envoy was eliminated as the root cause. Inspecting kubectl logs -l app=opensearch -n ite pinned the 500 error directly to internal OpenSearch index lock contention.
  • Observation: Requests to schema-registry.ite-dev.example.com threw:
503 Service Unavailable: upstream connect error or disconnect/reset before headers. delayed connect error: Connection refused
  • Diagnosis: This signature indicates Envoy is healthy, but the backend pod is unreachable or crashing.
  • Remediation: An engineer attempted kubectl rollout restart svc schema-registry, which failed because Services are networking abstractions without rollouts. I identified the backing workload controller in schema-registry-cluster and triggered a graceful rollout:
The pods recovered, and Envoy immediately resumed routing traffic without downtime.
  • Zero-Downtime Migration: Successfully transitioned all ingress traffic from NGINX to Envoy Gateway v1.7.0 with zero dropped packets.
  • Enterprise Gatekeeper Compliance: Codified resource request and limit baselines satisfying strict Azure Policy requirements.
  • Edge Security Shift-Left: Centralized CORS preflight handling at the ingress layer while strictly isolating developer localhost exceptions to non-production overlays.
  • 512k Header Processing: Successfully preserved large authentication header support via declarative EnvoyPatchPolicy configurations.

Related projects

Automated OpenSearch Backup & Restore-Probe Verification Pipeline

Automated OpenSearch Backup & Restore-Probe Verification Pipeline

Architected a two-tier OpenSearch disaster recovery ecosystem on Azure Kubernetes Service (AKS) combining full-namespace Azure Backup Vault infrastructure snapshots with incremental per-index Azure Blob snapshots, an automated restore-probe verification CronJob, and KQL-based Azure Monitor alerting.
OpenSearch
Azure Backup Vault
Disaster Recovery
Kubernetes
Automated Probes
Automating Cloud Inventory Across 400+ AWS Accounts

Automating Cloud Inventory Across 400+ AWS Accounts

Architected a zero-touch cloud inventory engine across 400+ AWS accounts using Kubernetes CronJobs, AWS Config Aggregators, and HashiCorp Vault CSI. Transformed raw multi-account telemetry into Amazon Aurora to power an enterprise-grade FinOps command center and Grafana dashboard tracking 200,000+ resources.
AWS STS
Amazon Aurora
HashiCorp Vault
Kubernetes
FinOps