If we want to run this same application in multiple different environments, like staging and production, we would need to have two copies of this manifest just to change the value of these environment variables. This is one of the problems with embedding these environment variables in the manifest.
Luckily, Kubernetes has a high level resource called ConfigMap that serves this purpose. It’s basically a place for us to store key-value pairs that can be injected into our containers when they run. Let’s see an example.
xxxxxxxxxx
# hellok8s-config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hellok8s-config
data:
MESSAGE: "It works with a ConfigMap!"
xxxxxxxxxx
A ConfigMap is an API object used to store non-confidential data in key-value pairs.
Pods can consume ConfigMaps as environment variables
ReplicaSets manage pods