Kubernetes Certification Training Course : Lecture 5

Sometimes the Pod has to be supplied with data when running, so the data will be injected to the Pod. That is where ConfigMaps and Secrets will help. ConfigMaps and Secrets are key values pairs. The difference between them is that data in Secrets are encoded.

There are two ways of creating o ConfigMap:

  • from-literal (data is provided in parameter), for example – kubectl create cm cm1 –from-literal=color=green
  • from file (data is in the file), for example – kubectl create cm cm2 –from-file=<full name of the file>

ConfigMap saves all the details in etcd database.

There are two ways of delivering ConfigMaps to a Pod:

Example of submitting secret to a Pod via volumes is here. Via environment variable – here. Environment variables can be defined inside the container, with values taken from ConfigMap, like in this example.

kubectl exec <pod name> — printenv – command that prints all environment variables of the Pod

continued here

Previous

Leave a Reply

Your email address will not be published. Required fields are marked *