To provide configuration for an application running on Kubernetes, there are a couple of possible approaches, documented in https://kubernetes.io/docs/tasks/inject-data-application/:
- Passing arguments to the container commands
- Defining system environment variables for the container
- Mounting ConfigMaps or Secrets as container volumes
- Optionally wrapping everything up using PodPresets
This section will focus on using ConfigMaps and Secrets, which are, in many aspects, similar but have very different purposes.
First, let's take a look at Secrets. In almost every application, you will have to manage sensitive information for accessing dependencies, such as passwords, OAuth tokens, ...