All ConfigMaps we created so far were done through kubectl create cm commands. It would be a shame if we could not specify them through YAML definitions, just like other Kubernetes resources and objects. Fortunately, we can. Everything in Kubernetes can be defined as YAML, and that includes ConfigMaps as well.
Even though we have not yet specified ConfigMaps as YAML, we have seen the format quite a few times throughout this chapter. Since I cannot be sure whether you can create a ConfigMap YAML file from memory, let's make things easy on 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: v1 data: something: else weather: sunny kind: ConfigMap metadata: name: my-config ...
Just as with any other Kubernetes object, ConfigMap...