To follow along with this tutorial, click on the Import to Doppler button below to create the Doppler project containing the required variables, including the TLS certificate and key.
You can either use the Doppler dashboard to copy and paste in the contents of your certificate and key, or the Doppler CLI as per below:
1doppler secrets set TLS_CERT="$(cat ./tls.cert)"
2doppler secrets set TLS_KEY="$(cat ./tls.key)"
Now that your TLS certificate and key are in Doppler, the next step is syncing them to a Kubernetes secret using the Doppler CLI.
We recommend using Kubernetes' built-in TLS Secret type type as it standardizes the property names inside the secret to tls.crt and tls.key:
1kubectl create secret tls doppler-tls-pem \
2 --cert <(doppler secrets get TLS_CERT --plain) \
3 --key <(doppler secrets get TLS_KEY --plain)
We can see this by describing the secret:
1kubectl describe secret doppler-tls-pem
2
3# >> Name: doppler-tls-pem
4# >> Namespace: default
5# >> Labels:
6# >> Annotations:
7# >>
8# >> Type: kubernetes.io/tls
9# >>
10# >> Data
11===# >> =
12# >> tls.crt: 1545 bytes
13# >> tls.key: 1704 bytes
The below deployment mounts the TLS certificate and key inside a container.
As the mountPath is set to /usr/src/app/secrets, the path to the certificate and key will be:
While the Doppler CLI makes it easy to sync TLS secrets, its only drawback is having to manually sync updates to the TLS secrets in Kubernetes when they're updated in Doppler.
We recommend leveling up to use our Kubernetes Operator, which instantly syncs secrets to Kubernetes when changed and includes support for auto-reloading of deployments when secrets are updated inside the cluster.
Learn more by checking out the Kubernetes Operator repository on GitHub.
Awesome work! Now you know how to use Doppler to simplify and securely manage TLS secrets in PEM format for your Kubernetes-hosted applications.
Be sure to check out our Kubernetes documentation and reach out in our Doppler Community Forum if you need help.
Stay up to date with new platform releases and get to know the team of experts behind them.
Trusted by the world’s best DevOps and security teams. Doppler is the secrets manager developers love.