To use env variables from secrets I know we can use env: valueFrom: secretKeyRef and then secret name and each key. This is by each key. Is there a way to get this for all keys in the secret.
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: webapp-pod
spec:
containers:
- name: mycontainer
image: kodekloud/simple-webapp-mysql
env:
- name: DB_Host
valueFrom:
secretKeyRef:
name: db-secret
key: DB_Host
- name: DB_User
valueFrom:
secretKeyRef:
name: db-secret
key: DB_User
- name: DB_Password
valueFrom:
secretKeyRef:
name: db-secret
key: DB_Password
restartPolicy: Never
EOF