Kubernetes 101 : Secret object as mounted files on the pods



We usually don't build sensitive information like passwords within the application's image.

We use a kubernetes object called secret, than we could mount it onto the pod, so it can have access to it.

Below is a Yaml file of our secret with one variable:


We create our secret using the below command:


Below is the Yaml file of the pod that will be using our above secret object as below:



Remark:

Keys in the secret’s data parameter - In the Yaml file of the secret -  become filenames under the mountPath /tmp/secret_dir”.

We create our pod using the below command:


We could check if our secret is accessible from within the pod using the below command:



Comments

Leave as a comment:

Archive