Injecting Configurations from Multiple Files
Learn how to inject configurations from multiple files and directories.
Creating a ConfigMap from multiple files
Let's see what happens when we execute the following commands:
Press + to interact
kubectl create cm my-config \--from-file=cm/prometheus-conf.yml \--from-file=cm/prometheus.ymlkubectl create -f cm/alpine.yml#Run the following command separatelykubectl exec -it alpine -- \ls /etc/config
We create a ConfigMap with two files and the same Pod based on the alpine.yml
definition. Finally, we output the list of files from the /etc/config
directory inside the Pod’s only container. The output of the latter command is as follows:
Press + to interact
prometheus-conf.yml prometheus.yml
We can ...