Secrets can be injected in a container inside a pod as follows
As environment variables
envFrom:
- secretRef:
name: secret-nameAs single environment variable
env:
- name: password
valueFrom:
secretKeyRef: secret-name
key: key-nameAs 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