Sub topic 16
Cutover, rollback and cleanup
This chapter covers the last stage of the migration: moving live traffic from Ingress NGINX to the Gateway API, keeping a way back, and removing the old stack. It assumes that your Gateway and HTTPRoutes already run in parallel with the old Ingress. It also assumes that Accepted and ResolvedRefs show True in the resource status, and that you have tested the new data path directly.
Prepare before you switch
DNS caching is the main reason cutovers go wrong. Resolvers keep old answers until the record's TTL expires, so a change made at the wrong time can take hours to reach every client.
- Lower the TTL of the hostname's record, for example to 60 seconds. Do this at least one old-TTL period before the cutover.
- Write down the current DNS target (the old load balancer address). This value is your rollback.
- Confirm the new Gateway has an address:
kubectl get gateway shared-gateway -n gateway-system. - Check that the certificate Secret is valid for the hostname.
Cut over in stages
Avoid switching everything at once. Weighted DNS records (or a traffic manager that supports weights) let you send a small share to the new Gateway first.
At each step, watch error rates, latency and the logs of both controllers for a full traffic cycle before you increase the weight. If your DNS provider has no weighted records, switch one low-risk hostname first and then the rest.
Roll back
Rollback means restoring the DNS target you recorded. This works only if the old Ingress and its controller are still running, so do not delete them during the cutover. With a low TTL, most clients return to the old path within a few minutes. Clients may still hold a cached answer for up to one TTL period, so keep both stacks healthy until that time has passed.
Clean up
After a stable period, such as one to two weeks, remove the old stack in this order:
- Confirm that the old controller receives almost no requests.
- Scale the Ingress NGINX deployment to zero and wait. This step is reversible.
- Delete the Ingress resources, then uninstall the controller and its IngressClass.
- Remove temporary resources, such as test routes and unused ReferenceGrants.
- Restore the DNS TTL to its normal value.
kubectl scale deployment ingress-nginx-controller -n ingress-nginx --replicas=0
kubectl get ingress -A
kubectl delete ingress app -n shopKeep your manifests in version control so that a deleted resource can be recreated.
Exercise
Why should you lower the DNS TTL before the cutover, and why should you not delete the old Ingress right after switching?
Show answer
A low TTL makes resolvers pick up the change quickly, both for the cutover and for a rollback. The old Ingress and controller are the rollback target, so deleting them early removes your way back if the Gateway has a problem.