<p>I have the following files from letsencrypt <code>cert.csr, cert.pem, chain.pem, fullchain.pem, privkey.pem</code>
and I copied the base64 version of cert.pem and privkey.pem.</p>
<p><code>cat cert.pem  | base64</code> and <code>cat privkey.pem | base64</code></p>
<p>But I get the following error:</p>
<p><code>error: error parsing test-secret-tls.yml: error converting YAML to JSON: yaml: line 10: could not find expected ':'</code></p>
<p>Also I wonder how the documentation and other articles use one line for the cert and key values while I have a mutliline values.</p>
<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: test-certs-secret
  namespace: test-web-dev
type: kubernetes.io/tls
data:
  tls.crt: VkRBVmtoVlVocEZCbjVPaUd1bFdYaGdwQUEKV0JQb3BUeFQvcDVqamtwVUdRRFhSU2FZc29HSVht
VkRBVmtoVlVocEZCbjVPaUd1bFdYaGdwQUEKV0JQb3BUeFQvcDVqamtwVUdRRFhSU2FZc29HSVht
VkRBVmtoVlVocEZCbjVPaUd1bFdYaGdwQUEKV0JQb3BUeFQvcDVqamtwVUdRRFhSU2FZc29HSVht
  tls.key: VkRBVmtoVlVocEZCbjVPaUd1bFdYaGdwQUEKV0JQb3BUeFQvcDVqamtwVUdRRFhSU2FZc29HSVht
VkRBVmtoVlVocEZCbjVPaUd1bFdYaGdwQUEKV0JQb3BUeFQvcDVqamtwVUdRRFhSU2FZc29HSVht
VkRBVmtoVlVocEZCbjVPaUd1bFdYaGdwQUEKV0JQb3BUeFQvcDVqamtwVUdRRFhSU2FZc29HSVht
</code></pre>

user630702
<p>While encoding the cert and private key, you can specify the <code>-w</code>(linux) or <code>-b</code>(macOS) flag to the <code>base64</code> command to encode it in a single line.</p>
<p>You can then use those in your yaml and it should not complain.</p>
<p>For linux:</p>
<pre><code>cat cert.pem  | base64 -w0
cat privkey.pem | base64 -w0
</code></pre>
<p>For macOS:</p>
<pre><code>cat cert.pem  | base64 -b0
cat privkey.pem | base64 -b0
</code></pre>
