We normally don't build sensitive information like password inside the image.
In our example, we store them in a kubernetes object called secret, then we make them available to our pod through environment variables.

We start by creating a secret object using the command line, as below:


Our secret "secret_1" has two values, "user" and  "password".

We, then create the pod that will be using our secret object "secret_1"as below:


After creating our pod, using the "kubectl apply" command, we could check if the information in our secret object is accessible through the environment variables of the pod, using the below command:


Remark:

"kubectl exec" executes a command inside a running pod, the command appears after the characters "--".
Brando Sabatini and Ikbal C ©. Powered by Blogger.