Skip to content

env

env value in Kubedeploy can be used to define environment variables that will be configured on all containers in a Pod.

User can define containers env variable by passing the supported config.

Note

By default containers env is undefined.

Define simple env var for container

values.yaml
1
2
3
4
5
6
7
8
nameOverride: my-app
image:
  repository: nginx
  tag: latest

env:
  - name: NGINX_PORT
    value: 8080
Deploy command
helm install webapp sysbee/kubedeploy -f values.yaml

We can also use extended version to define environment values from ConfigMap or Secret objects.

Define env var from other sources

values.yaml
nameOverride: my-app
image:
  repository: nginx
  tag: latest

env:
  # fetch value from ConfigMap
  - name: NGINX_PORT
    valueFrom:
      configMapKeyRef:
        name: configmap-name
        key: nginx-port

  # fetch value from Secret
  - name: NGINX_HOSTNAME
    valueFrom:
      secretKeyRef:
        name: secret-name
        key: nginx-hostname
        optional: true
Deploy command
helm install webapp sysbee/kubedeploy -f values.yaml

Defining multiple env vars from other sources

While the above example might work for referening couple of secret keys for extracting values, the configuration in values.yaml can be simplified by using envFrom

See also: