Skip to content

Consider adding --env-from-secret or support for setting env vars in kubectl run via secrets #51276

Closed
@SEJeff

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

Metadata

Assignees

No one assigned

    Labels

    area/kubectlkind/featureCategorizes issue or PR as related to a new feature.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.sig/cliCategorizes an issue or PR as relevant to SIG CLI.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions