<p>I'm struggling to setup a kubernetes secret using GoDaddy certs in order to use it with the Ingress Nginx controller in a Kubernetes cluster.</p>
<p>I know that GoDaddy isn't the go-to place for that but that's not on my hands...</p>
<p>Here what I tried (mainly based on this <a href="https://rammusxu.github.io/2019/11/06/k8s-Use-crt-and-key-in-Ingress/" rel="nofollow noreferrer">github post</a>):</p>
<p>I have a mail from GoDaddy with two files: <code>generated-csr.txt</code> and <code>generated-private-key.txt</code>.</p>
<p>Then I downloaded the cert package on GoDaddy's website (I took the &quot;Apache&quot; server type, as it's the recommended on for Nginx). The archive contains three files (with generated names): <code>xxxx.crt</code> and <code>xxxx.pem</code> (same content for both files, they represent the domain cert) and <code>gd_bundle-g2-g1.crt</code> (which is the intermediate cert).</p>
<p>Then I proceed to concat the domain cert and the intermediate cert (let's name it chain.crt) and tried to create a secret using these file with the following command:</p>
<pre><code>kubectl create secret tls organization-tls --key generated-private-key.txt --cert chain.crt
</code></pre>
<p>And my struggle starts here, as it throw this error:</p>
<pre><code>error: tls: failed to find any PEM data in key input
</code></pre>
<p>How can I fix this, or what I'm missing?</p>
<p>Sorry to bother with something trivial like this, but it's been two days and I'm really struggling to find proper documentation or example that works for the Ingress Nginx use case...</p>
<p>Any help or hint is really welcome, thanks a lot to you!</p>

<p><em>This is a Community Wiki answer, posted for better visibility, so feel free to edit it and add any additional details you consider important.</em></p>
<p>As OP mentioned in comments, <strong>the issue was solved by adding a new line in the beginning of the file</strong>.</p>
<blockquote>
<p>&quot;The key wasn't format correctly as it was lacking a newline in the
beginning of the file. So this particular problem is now resolved.&quot;</p>
</blockquote>
<p>Similar issue was also addressed in <a href="https://stackoverflow.com/a/57614637/11714114">this answer</a>.</p>
