Can I add multiple hosts to the Ingress controller so that they refer to the same target group in the aws load balancer? Example:
rules:
- host: ["foobar.com", "api.foobar.com", "status.foobar.com"]
http:
paths:
- backend:
serviceName: foobar
servicePort: 80 ```
TLDR; no
Long answer:
In k8s source code you can see that host field's data type is string, so you cannot use array of strings in that place.
But you should be able to do the following:
rules:
- host: "foobar.com"
http:
paths:
- backend:
serviceName: foobar
servicePort: 80
- host: "api.foobar.com"
http:
paths:
- backend:
serviceName: foobar
servicePort: 80
- host: "status.foobar.com"
http:
paths:
- backend:
serviceName: foobar
servicePort: 80
You can use hostname wildcards if you are using Kubernetes > 1.18 version.
For more information check these links:
https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/basic-configuration/ https://kubernetes.io/docs/concepts/services-networking/ingress/
rules:
- host: "foobar.com"
http:
paths:
- backend:
serviceName: foobar
servicePort: 80
- host: "*.foobar.com"
http:
paths:
- backend:
serviceName: foobar
servicePort: 80
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With