Ingress-nginx: Feature request: [nginx] server aliases

Created on 22 Jun 2017  路  4Comments  路  Source: kubernetes/ingress-nginx

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.

Suggested implementation

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.

Use case

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.

help wanted nginx

Most helpful comment

Yes, just separate them with spaces instead of commas.

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings