Kubernetes Simple Redirect In Ingress Rule
Suppose you are moving some sort of tool from one Kubernetes cluster to another one, then it would be nice for your users to get a redirect from the old URL to the new one (or at least for a while).
You can achieve this by modifying your OLD ingress rule YML, by adding an annotation in it:
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: 'return 302 https://new-location.com/;'
Code language: YAML (yaml)
Of course leave the rest of the old ingress rule in tact, to let it being triggered on the old URL. You can scale the old deployment to zero, or just delete it.
We have used this for example when migrating from old on-premise Kubernetes clusters to new Azure Cloud Kubernetes clusters.