I have a service deployed on Kubernetes and it has url app.io
(using ingress).
What if I need a user to every time go to app.io
and:
-
if it’s running okay with no errors, it redirects to the
app.io
(on k8s) -
and if not running well or have an error, it would redirect on a backup service on Heroku for example with url
backup.io
.
How can I do that?
Thanks in advance
3
Answers
Fallback routing like you describe is not part of the Ingress standard. It only does routing based on incoming Host header and request path. It’s possible some specific Ingress Controller supports this as a custom extension but I don’t know of any that do.
I think you may need to put a L7 load balancer like HAproxy in front. Configure your backup location in backend pool, and HAProxy will take care of the rest.
You may want to configure ingress
befault-backend
to be some sort of fallback service. With most of the cases people tend to use that for some custom 404 but you might just direct it to another service, for examplebackup-io
:That’s of course assuming you’re using nginx controller. Kong has also fallback service instructions.