There are situations where you may need to have a server alias separate from the ingress host: entry - an annotation to add aliases would be handy.
I'd imagine something like:
...
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/ingress.serverAlias: anotherhostname.example.com
...
spec:
rules:
- host: mainhost.example.com
...
The implementation would just be to insert the contents of the serverAlias immediately after (space-separated) the $server.Hostname in the config template.
To expand on the use case - when the dns-controller is set to watch ingresses, all host: entries become DNS entries. If you want the ingress to listen for a host name, but control the DNS from elsewhere for just one of the entries (putting a CDN in front, for example), having the ability to add an alias via an annotation will be useful.
https://github.com/kubernetes/ingress/pull/1123
@egeland @aledbf Let me know what you think.
As far as I understand it, the commit looks like a perfect fit to what I'm looking for! :+1:
Hello, i haven't found many examples, at least not for this one; just wondering if it was possible to have multiple aliases
Something like : kubernetes.io/ingress.serverAlias: "site-b.com,site-c.com,site-d.com", or by passing a yaml array to the annotation
Yes, just separate them with spaces instead of commas.
Most helpful comment
Yes, just separate them with spaces instead of commas.