I have done exactly how it says I creted a secret mount it using envForm but still can’t run
but still I get x for no reason and can’t finish it the commad i used to create secret is
kubectl create secret generic prod-db --from-literal DB-Host=prod-db --from-literal DB-User=root --from-literal DB-Password=paswrd -n prod
It wants you to do it this way
- env:
- name: DB_Host
valueFrom:
secretKeyRef:
key: DB_Host
name: prod-db
- name: DB_User
valueFrom:
secretKeyRef:
key: DB_User
name: prod-db
- name: DB_Password
valueFrom:
secretKeyRef:
key: DB_Password
name: prod-db
Yes, the pod runs fine if you do it the other way, but the YAML is being inspected by the marking script to see which method was used.
This way of doing it ensures that only the named keys in the secret are loaded to the environment. If the secret contained additional keys, the other way would load all the keys and that might be considered a security issue.