Ahmed Nageh
Ahmed Nageh

Reputation: 11

How can I use ingress to control the routing between two instances?

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:

How can I do that?

Thanks in advance

Upvotes: 0

Views: 479

Answers (3)

acid_fuji
acid_fuji

Reputation: 6853

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.

Upvotes: 0

user16080361
user16080361

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

coderanger
coderanger

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

Related Questions