title: Kubernetes ingress tls
body: <p>I used the below command to generate a key locally.</p>
  
  <blockquote>
    <p>openssl genrsa -out testsvc.testns.ing.lb.xyz.io.key.pem 2048</p>
  </blockquote>
  
  <p>And the used the below command to generate the CSR(certificate signing request).</p>
  
  <blockquote>
    <p>openssl req -new -sha256 -key testsvc.testns.ing.lb.xyz.io.key.pem
    -subj "/CN=testsvc.testns.ing.lb.xyz.io"</p>
  </blockquote>
  
  <p>I generated the certificate chain file using the above CSR file and finally got the below file.</p>
  
  <blockquote>
    <p>testsvc.testns.ing.lb.xyz.io.chain.pem</p>
  </blockquote>
  
  <p>I am trying to use them for ingress tls and below is the command for ingress tls.</p>
  
  <blockquote>
    <p>kubectl create secret tls custom-tls-cert --key /path/to/tls.key
    --cert /path/to/tls.crt</p>
  </blockquote>
  
  <p>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.</p>
  
  <pre><code>"error: failed to load key pair tls: failed to find any PEM data in certificate input"
  </code></pre>
  
  <p>I would like to create the below secret.</p>
  
  <pre><code>apiVersion: v1
  data:
    tls.crt: base64 encoded cert
    tls.key: base64 encoded key
  kind: Secret
  metadata:
    name: testsecret
    namespace: default
  type: Opaque
  </code></pre>
  
  <p>Not sure how to generate .crt and .key file with the chain.pem file.</p>
  
  <p>Thanks</p>