Defining ConfigMaps as YAML
Explore defining ConfigMaps as YAML files.
We'll cover the following...
We'll cover the following...
All ConfigMaps we created so far were done through kubectl create cm commands. Everything in Kubernetes can be defined as YAML, and that includes ConfigMaps as well.
Looking into the YAML
Even though we have not yet specified ConfigMaps as YAML, we have seen the format quite a few times throughout this chapter. Since we cannot be sure whether we can create a ConfigMap YAML file from memory, let’s make things easy for ourselves and use kubectl to output our existing my-config ConfigMap in YAML format.
kubectl get cm my-config -o yaml
The output is as follows:
apiVersion: v1data:something: elseweather: sunnykind: ConfigMapmetadata:name: my-config...
Just as with any other Kubernetes object, ...