ConfigMaps and Secrets
Introduction & ConfigMaps Part 1
ConfigMaps and Secrets are utilities provided by Kubernetes to facilitate the development of cloud-native - or 12 factor  compliant - applications. In particular, ConfigMaps relate to chapter 3 Config of the 12 factor manifest. This best practice suggests to store application configuration outside the application, e.g. by using environment variables . This allows a strict separation of functionality and configuration which increases the portability of applications. An application thus can be operated from the same code base among different environments such as staging & production or the application could even be deployed per customer still using a single source code version.
So instead of hard-wiring the application configuration options or access credentials into source code, the better option is to use ConfigMaps and Secrets.
Both ConfigMaps and Secrets can be thought of key value sets managed using the Kubernetes API. In the following it will be shown how these key value sets can be created, maintained and retrieved.
- The Twelve Factor App, https://12factor.net/
- Environment Variables, Wikipedia, https://en.wikipedia.org/wiki/Environment_variable
- Kubernetes Documentation, Tasks, Configure a Pod to Use a ConfigMap, https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/