Consider adding --env-from-secret or support for setting env vars in kubectl run via secrets #51276
Closed
Description
/kind feature
What happened:
There is no current way to run a job via kubectl run
that allows setting the values of environment variables via secrets.
What you expected to happen:
Allow kubectl run
to have a synax for --env
or --env-from-secret="DATABASE_PASSWORD=secret-name-here.secret-key
How to reproduce it (as minimally and precisely as possible):
kubectl run dbmigrate --image=foo --env="DATABASE_PASSWORD=$TRY_TO_PUT_SECRET_HERE
Anything else we need to know?:
This would make it really nice for running something such as database migrations synchronously as part of CI builds before rolling out a new application deployment
The secret looks like this:
Data
====
postgres.user: 8 bytes
redis.db: 1 bytes
redis.host: 21 bytes
redis.password: 30 bytes
postgres.db: 8 bytes
postgres.host: 24 bytes
postgres.password: 30 bytes
and it would be perfect to use the values of those as env vars for kubectl run
.
Environment:
- Kubernetes version (use
kubectl version
):
1.7.1