I have a configmap where I have defined the following key-value mapping in the data
section:
apiVersion: v1
kind: ConfigMap
metadata:
namespace: test
name: test-config
data:
TEST: "CONFIGMAP_VALUE"
then in the definition of my container (in the deployment / statefulset manifest) I have the following:
env:
- name: TEST
value: "ANOTHER_VALUE"
envFrom:
- configMapRef:
name: test-config
When doing this I was expecting that the value from the configmap (TEST="CONFIGMAP_VALUE") will override the (default) value specified in the container spec (TEST="ANOTHER_VALUE"), but this is not the case (TEST always gets the value from the container spec). I couldn't find any relevant documentation about this - is it possible to achieve such env variable value overriding?
From Kubernetes api refernece : https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#container-v1-core
So above clearly states the env will take precedence than envFrom.
So, for overriding see below:
Check: