I am trying to run an application in Kubernetes that will be accessed via ingress control from the outside world. The ingress will add a path '/applicationName' and for which I need to configure the reverse proxy setting on the application. What is the best way to handle this requirement in kubernetes ?
I have tried few workarounds like putting the cluster or almsmart-nginx-ingress-controller.my-app.svc.cluster.local to resolve IP etc but I am not convinced with the approach.
Any suggestions ? Thanks in Advance.
The path in your ingress should point to the service and its port and your DNS need to point to ingress IP. If you are running on the cloud infrastructure, then Ingress(one of the ingress implementations) will be behind Service of Type=LoadBalancer(so point your DNS to that), and then requests received by the Ingress will be forwarded to services, depending on the Host and Path in the request.
Here is a sample of a spec part of an ingress object:
spec: rules:
- host: first.example.com
http:
paths:
- path: /
backend:
serviceName: firstservice
servicePort: 80
- host: second.example.com
http:
paths:
- path: /
backend:
serviceName: secondservice
servicePort: 80