Hopefully, even when our applications need different configs to work in distinct clusters, the differences are limited. Often, they should be limited to only a few key/value entries. In such cases, it might be easier to create ConfigMaps using --from-literal.
Let's take a look at an example:
kubectl create cm my-config \
--from-literal=something=else \
--from-literal=weather=sunny
kubectl get cm my-config -o yaml
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 two entries were added, one for each literal.
Let's create a Pod with the ConfigMap mounted:
kubectl create -f cm/alpine.yml
kubectl exec -it alpine -- \
ls /etc/config
The output of the latter command is as follows...