Using k8s ingress, is it possible using the same domain send incoming http traffic to a port and https traffic to other port?
I have not find anything in the ingress sepecification to do it or annotations in nginx-ingress-controller
You will need two objects i.e, service and ingress for this. You need to configure ingress similar to below:
spec:
rules:
- host: abc.com
http:
paths:
- backend:
serviceName: myservice
servicePort: 80
path: /uiaccesscontrol
- backend:
serviceName: myservice
servicePort: 443
path: /uiaccesscontrol
and service will have configurations similar as given below:
spec:
ports:
- name: http
port: 80
targetPort: 80
- name: https
port: 443
targetPort: 443
Now, https traffic will be routed to secure port 443 and http to 80.