Lukas Rieger
Lukas Rieger

Reputation: 786

Can I configure nginx-ingress to route traffic to outside the cluster

If I have a kubernetes cluster in AKS with an nginx-ingress, can I then forward certain traffic to something external to the cluster like an App Service?

enter image description here

If I open my-domain.com/svc3, I want traffic to be routed to the App Service.

If this is not directly possible, what would be the best solution?

1) I could put an additional load balancer (like AppGateway) in front of both the AKS cluster and the App Service

2) I could instantiate a second nginx as a service, which then routes traffic to the app service

3) ... ?

Upvotes: 3

Views: 1763

Answers (1)

Harsh Manvar
Harsh Manvar

Reputation: 30113

I think you can use mapping external service to kubernetes :

kind: Service
apiVersion: v1
metadata:
 name: external-service
Spec:
 type: ClusterIP
 ports:
 - port: 80
   targetPort: 80

here the endpoint :

kind: Endpoints
apiVersion: v1
metadata:
 name: external-service
subsets:
 - addresses:
     - ip: 101.280.1.44
   ports:
     - port: 80

For more information you can check this video also :

https://www.youtube.com/watch?v=fvpq4jqtuZ8

you can also read this document for more information : https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-mapping-external-services

Upvotes: 3

Related Questions