From the course: Certified Kubernetes Application Developer (CKAD) Cert Prep

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Providing variables with ConfigMaps

Providing variables with ConfigMaps

- The most elegant way to provide variables is by using the ConfigMap. ConfigMap is an API resource to store site specific information. It is really the replacement in Kubernetes for what you would do with a configuration file on a stand alone Linux environment. ConfigMap has two different uses. You can use it for storing variables, and you can use it for storing configuration files with a size up to one mebibyte. If a bigger amount of data is needed, then it should be stored in a Pod Volume, and you should mount the Pod Volume to present the data within a pad. That's also an option. But here, we'll explore ConfigMap. So how does it work? Well, if you want to create variables in ConfigMap, you start with kubectl create cm, followed by --from-literal key is value, or --from-env-file is path to file. So we have two different options. I think you specify the key and the value directly on the command line. Or you create an environment file, which is a file that has multiple variables you…

Contents