Let's take a look at the cm/my-env-file.yml file:
cat cm/my-env-file.yml
The output is as follows:
something=else weather=sunny
The file has the same key/value pairs as those we used in the example with --from-literal:
Let's see what happens if we create a ConfigMap using that file as the source.
kubectl create cm my-config \ --from-env-file=cm/my-env-file.yml kubectl get cm my-config -o yaml
We created the ConfigMap using the --from-env-file argument, and we retrieved the ConfigMap in yaml format.
The output of the latter command is as follows (metadata is removed for brevity):
apiVersion: v1 data: something: else weather: sunny kind: ConfigMap ...
We can see that there are two entries, each corresponding to key/value pairs from the file. The result is the same as when we created a ConfigMap using...