Defining ConfigMaps as YAML

In this lesson, we will explore defining ConfigMaps as YAML files.

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.

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 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.

Get hands-on with 1200+ tech skills courses.