I used the below command to generate a key locally.
openssl genrsa -out testsvc.testns.ing.lb.xyz.io.key.pem 2048
And the used the below command to generate the CSR(certificate signing request).
openssl req -new -sha256 -key testsvc.testns.ing.lb.xyz.io.key.pem -subj "/CN=testsvc.testns.ing.lb.xyz.io"
I generated the certificate chain file using the above CSR file and finally got the below file.
testsvc.testns.ing.lb.xyz.io.chain.pem
I am trying to use them for ingress tls and below is the command for ingress tls.
kubectl create secret tls custom-tls-cert --key /path/to/tls.key --cert /path/to/tls.crt
Not sure, How can i use the chain.pem file and key.pem file with the above command. Tried generating crt from the chain.pem and getting error on kubectl create secret.
"error: failed to load key pair tls: failed to find any PEM data in certificate input"
I would like to create the below secret.
apiVersion: v1
data:
tls.crt: base64 encoded cert
tls.key: base64 encoded key
kind: Secret
metadata:
name: testsecret
namespace: default
type: Opaque
Not sure how to generate .crt and .key file with the chain.pem file.
Thanks
kubectl create secret tls NAME --cert=path/to/cert/chain.pem --key=path/to/key/key.pem
– Suresh Vishnoi