Support setting env vars in kubectl run

This commit is contained in:
feihujiang
2015-09-01 11:03:29 +08:00
parent bb3e20e361
commit 84e94e39cd
8 changed files with 198 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ Create and run a particular image, possibly replicated.
Creates a replication controller to manage the created container(s).
```
kubectl run NAME --image=image [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json]
kubectl run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json]
```
### Examples
@@ -51,6 +51,12 @@ kubectl run NAME --image=image [--port=port] [--replicas=replicas] [--dry-run=bo
# Start a single instance of nginx.
$ kubectl run nginx --image=nginx
# Start a single instance of hazelcast and let the container expose port 5701 .
$ kubectl run hazelcast --image=hazelcast --port=5701
# Start a single instance of hazelcast and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container.
$ kubectl run hazelcast --image=hazelcast --env="DNS_DOMAIN=local" --env="POD_NAMESPACE=default"
# Start a replicated instance of nginx.
$ kubectl run nginx --image=nginx --replicas=5
@@ -76,6 +82,7 @@ $ kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
--attach[=false]: If true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...' were called. Default false, unless '-i/--interactive' is set, in which case the default is true.
--command[=false]: If true and extra arguments are present, use them as the 'command' field in the container, rather than the 'args' field which is the default.
--dry-run[=false]: If true, only print the object that would be sent, without sending it.
--env=[]: Environment variables to set in the container
--generator="": The name of the API generator to use. Default is 'run/v1' if --restart=Always, otherwise the default is 'run-pod/v1'.
--hostport=-1: The host port mapping for the container port. To demonstrate a single-machine container.
--image="": The image for the container to run.
@@ -126,7 +133,7 @@ $ kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra at 2015-08-29 13:01:26.772003236 +0000 UTC
###### Auto generated by spf13/cobra at 2015-09-07 06:40:12.142439604 +0000 UTC
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_run.md?pixel)]()