for plain key value
env:
- name: APP_COLOR
value: pink
for ConfigMap
env:
- name: APP_COLOR
valueFrom:
configMapKeyRef:
for Secrets
env:
- name: APP_COLOR
valueFrom:
secretKeyRef:
example for a pod definition file with brut variable
apiVersion: v1
kind: Pod
metadata:
name: myapp
namespace: default
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-container
image: nginx
env:
- name: APP_COLOR
value: pink
exemple for config map
---
apiVersion: v1
kind: Pod
metadata:
labels:
name: webapp-color
name: webapp-color
namespace: default
spec:
containers:
- env:
- name: APP_COLOR
valueFrom:
configMapKeyRef:
name: webapp-config-map
key: APP_COLOR
image: kodekloud/webapp-color
name: webapp-color
Source : kodekloud.com