skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
  3. You may want to configure ingress befault-backendto 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search