Reputation: 11
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
Upvotes: 0
Views: 479
Reputation: 6853
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 example backup-io
:
kind: Ingress
metadata:
name: my-ingress
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: "/"
nginx.ingress.kubernetes.io/default-backend: backup-io
That's of course assuming you're using nginx controller. Kong has also fallback service instructions.
Upvotes: 0
Reputation:
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.
Upvotes: 0
Reputation: 54181
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.
Upvotes: 1