Kubernetes - How can I route pod egress traffic based on ingress

Viewed 22

I have an application that currently is deployed multiple times to an Kubernetes cluster because it needs to call different sources based on the URLs that it is called with. You could call them lanes. These deployments are well automated by a CI/CD pipeline.

The problem is, most of these lanes are not frequently used, yet they still need to be available. And we have a lot of applications following this pattern. I'd love to be able to deploy less pods that can handle the traffic of all lanes and still call the appropriate dependencies.

I know we could 'fix' this problem by incorporating switching logic within the application and passing the lane in a header or something, but that seems like a can of worms and can be problematic in production if that logic isn't necessary there.

I know you can have a single deployment with multiple ingresses.

Is it possible to use the ingress API to accomplish something like this in my kube.yml where I could choose or rewrite outgoing urls based on which ingress was called? https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/

Is there something in the nginx API that I could use in my kube.yml to accomplish this? https://docs.nginx.com/nginx-ingress-controller/

Thanks for the help!

0 Answers
Related