Secret in a pod

Secrets can be injected in a container inside a pod as follows

As environment variables

envFrom:
  - secretRef:
      name: secret-name

As single environment variable

env:
  - name: password
    valueFrom:
      secretKeyRef: secret-name
      key: key-name

As files in a volume

Each key in the secret will be created as a file in the directory of the volume. Each file will contain the value of the secret.

volumes:
  - name: secret-volume
    secret:
      secretName: secret-name
Links to this page
#kubernetes