We have one service which has two exposed ports- one is for server and second is for management. Kubernetes cluster have NGINX controller running. Is there any way to expose both the ports of service in Ingress YAML file? Details: Service server Port : 8081 Service Management Port: 8082 We tried with two "backends" in Ingress YAML file but it works only for default port which is 80 and fail for any other port. ingress.yml file is as below:
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: bw-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: my.host.net
http:
paths:
- path: "/controller/"
backend:
serviceName: bw-svc1
servicePort: 80
- path: "/actuator/"
backend:
serviceName: bw-svc2
servicePort: 5612
The indentation level of both paths is not equal in your config sample.
Other than that your config looks correct and should result in the following behavior:
my.host.net/controller
will be sent to service bw-svc1:80
my.host.net/actuator
will be sent to service bw-svc2:5612
If this is not what you'd like to achieve, could you please re-phrase your question?