Kubernetes: Is there a way to retrieve or inject local env vars into configmap.yaml?

11/24/2020

This may belong in sys admin, but as I was preparing a kubectl apply -f configmap.yaml, I was curious if there is an official way of defining and getting env vars from the local .bash_profile or .zprofile.

For example,

apiVersion: v1
kind: ConfigMap
metadata:
  name: appconfig
  labels:
    app: app
data:
  DATA_POINT: ${GET_DATA_POINT_FROM_LOCAL_ENV_VAR} <-- Is there an official way to inject/retrieve locally defined env vars when I kubectl apply -f?

I did my obligatory search through kubernetes documentation and google. No luck.

Does anyone know an official way to inject/retrieve locally defined env vars into the configmap.yaml when I kubectl apply -f?

-- Mykel
configmap
kubectl
kubernetes
yaml

0 Answers