When we create a Pod in Kubernetes, we can set the environment variables for the container(s) the Pod will create. We can do this by the env
key. env
is an array of the name and value of environment variables.
apiVersion: v1
kind: Pod
metadata:
name: name-of-pod
spec:
containers:
- name: container-name
image: image-name
env:
- name: NAME_OF_ENVIRONMENT_VARIABLE
value: 'Value of environment variable