-
If the config map is mounted into the pod as a volume, it will automatically update not instantly, and the files will change inside the container.
-
If it is an environment variable it stays as the old value until the container is restarted.
For example: create a new config.yaml with your custom values
apiVersion: v1
kind: ConfigMap
metadata:
name: testconfig
namespace: default
data:
config.yaml: |
namespaces:
default
labels:
"app"
"owner"
Then create a pod definition, referencing the ConfigMap
apiVersion: v1
kind: Pod
metadata:
name: testobject
spec:
serviceAccountName: testobject
containers:
name: testobject
image: test/appv1
volumeMounts:
name: config-volume
mountPath: /app/config.yaml
subPath: config.yaml
volumes:
name: config-volume
configMap:
name: testconfig
restartPolicy: Never