Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure multiple certificates for the same domain name #1899

Closed
alexandersm opened this issue Aug 25, 2021 · 2 comments
Closed

Configure multiple certificates for the same domain name #1899

alexandersm opened this issue Aug 25, 2021 · 2 comments
Labels
proposal An issue that proposes a feature request
Milestone

Comments

@alexandersm
Copy link

alexandersm commented Aug 25, 2021

Hello,

In the Nginx documentation at http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate there is a possibility to specify ssl_certificate / ssl_certificate_key directives multiple times for the same domain name.

Is it possible to configure Nginx Ingress to use more than one TLS secret for the same domain name ?
I've tried the following configuration :

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-for-ingress-ingress
 
spec:
  ingressClassName: nginx
  tls:
    - hosts:
        -  my.domain.com
      secretName: test1

    - hosts:
        -  my.domain.com
      secretName: test2

  rules:
  - host: my.domain.com
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: httpservice
            port:
              number: 9050

but then I checked resulting Nginx configuration inside the ingress pod and found out that only certificate and key from the second secret is used.

Thanks in advance for the help

Aha! Link: https://nginx.aha.io/features/IC-304

@github-actions
Copy link

Hi @alexandersm thanks for reporting!

Be sure to check out the docs while you wait for a human to take a look at this 🙂

Cheers!

@pleshakov
Copy link
Contributor

pleshakov commented Aug 25, 2021

Hi @alexandersm

The Ingress Controller doesn't support multiple TLS secrets. However, could you possible try the following workaround?

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: cafe-ingress
  annotations:
    nginx.org/server-snippets: |
      ssl_certificate /etc/nginx/secrets/default-second-cafe-secret; # namespace-name
      ssl_certificate_key /etc/nginx/secrets/default-second-cafe-secret; # namespace-name
spec:
  ingressClassName: nginx
  tls:
  - hosts:
    - cafe.example.com
    secretName: cafe-secret
  - hosts: # this part is needed so that the IC gets the second-cafe-secret from k8s API and store it on the file system at /etc/nginx/secrets/namespace-name
    - random-workaround-host 
    secretName: second-cafe-secret
  rules:
  - host: cafe.example.com

@pleshakov pleshakov added the proposal An issue that proposes a feature request label Sep 28, 2021
@brianehlert brianehlert added this to the Candidates milestone Oct 15, 2021
@nginx nginx locked and limited conversation to collaborators Jul 4, 2024
@brianehlert brianehlert converted this issue into discussion #5963 Jul 4, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
proposal An issue that proposes a feature request
Projects
None yet
Development

No branches or pull requests

3 participants