The documentation does not specify how to add an intermediate SSL certificate: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
I suppose the next step would be to read the Kubernetes source code.
It has to be appended to the same file. Just like nginx.
If you add multiple certificates in tls.cert
key in Kubernetes TLS Ingress Configuration. Please do this like this
-----BEGIN CERTIFICATE-----
<put your certificate value in a single line >
-----END CERTIFICATE-----
-----BEGIN INTERMEDIATE CERTIFICATE-----
<put your certificate value in a single line>
-----END INTERMEDIATE CERTIFICATE-----
Otherwise, you'll get an error in ssl cert chain validation.
Always put main certificate first.
Use this command to create a cert
kubectl create secret generic tlscert_with_ca --from-file=tls.crt=your_cert.crt --from-file=tls.key=your_key.key --from-file=ca.crt=your_ca.crt
BTW, your_ca.crt
could be a intermediate cert as well
It works to me, the cert in nginx-inginx-controller should like this
-----BEGIN CERTIFICATE-----
your_cert
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
your_key
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
your_intermediate
-----END CERTIFICATE-----
Reference official doc