<p>I just started to explore Kubernetes and I deployed a service in a container on Kubernetes which is running on a cloud.</p>

<p>My service requires to make a call to a database which requires a certificate for authentication. I am wondering what would be the best practice to store/install the certificate on Kubernetes </p>

<p>I need to access the certificate from my code which I am using as follows</p>

<pre><code>const (
    serverCertificate = "./cert/api.cer"
    serverPrivateKey  = "./cert/api.key"
)
creds, err := credentials.NewServerTLSFromFile(serverCertificate, serverPrivateKey)
</code></pre>

DoIt
<p>You could store the certificate in a Kubernetes Secret: <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="noreferrer">https://kubernetes.io/docs/concepts/configuration/secret/</a></p>

<p>Here is an example on how to do so:
<a href="https://kubernetes.io/docs/concepts/configuration/secret/#creating-a-secret-using-kubectl-create-secret" rel="noreferrer">https://kubernetes.io/docs/concepts/configuration/secret/#creating-a-secret-using-kubectl-create-secret</a></p>
