How to setup multiple Ingresses for the same domain but with different ports #4480
-
Hi, I run an old version of the ingress controller and have two ingresses for the same host domain but they run with different ports (e.g. both ingresses run on foo.bar but on ports 8096 and 8097). As this will cause a host name collision, I cannot use it anymore. I thought to use the mergeable ingresses with a master and minion ingress but there the apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: foo
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.org/listen-ports-ssl: "8096"
spec:
tls:
- hosts:
- foo.bar
secretName: tls
rules:
- host: foo.bar
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: foo
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.org/listen-ports-ssl: "8097"
spec:
tls:
- hosts:
- foo.bar
secretName: tls
rules:
- host: foo.bar |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 19 replies
-
According to the documentation I have not tried this, but you should be able to have one hosts entry and define both ports with a single annotation in the same Master Ingress (or single Ingress if not doing master/minion). In the master / minion model, the master always holds the hostname. And the minions are individual paths that get unique settings. |
Beta Was this translation helpful? Give feedback.
@hahahannes You can use snippets to add another port to the
virtualServer
. You can use something like the following:That will add 8081 to the
cafe.example.com
server block.The full example: