Reputation: 3167
I have the following files from letsencrypt cert.csr, cert.pem, chain.pem, fullchain.pem, privkey.pem
and I copied the base64 version of cert.pem and privkey.pem.
cat cert.pem | base64
and cat privkey.pem | base64
But I get the following error:
error: error parsing test-secret-tls.yml: error converting YAML to JSON: yaml: line 10: could not find expected ':'
Also I wonder how the documentation and other articles use one line for the cert and key values while I have a mutliline values.
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
Upvotes: 1
Views: 577
Reputation: 1451
While encoding the cert and private key, you can specify the -w
(linux) or -b
(macOS) flag to the base64
command to encode it in a single line.
You can then use those in your yaml and it should not complain.
For linux:
cat cert.pem | base64 -w0
cat privkey.pem | base64 -w0
For macOS:
cat cert.pem | base64 -b0
cat privkey.pem | base64 -b0
Upvotes: 3