Commit d4a47bdb authored by Anastasis Andronidis's avatar Anastasis Andronidis

rename run-container to run in kubectl

parent b8a808b1
...@@ -537,9 +537,9 @@ _kubectl_proxy() ...@@ -537,9 +537,9 @@ _kubectl_proxy()
must_have_one_noun=() must_have_one_noun=()
} }
_kubectl_run-container() _kubectl_run()
{ {
last_command="kubectl_run-container" last_command="kubectl_run"
commands=() commands=()
flags=() flags=()
...@@ -901,7 +901,7 @@ _kubectl() ...@@ -901,7 +901,7 @@ _kubectl()
commands+=("exec") commands+=("exec")
commands+=("port-forward") commands+=("port-forward")
commands+=("proxy") commands+=("proxy")
commands+=("run-container") commands+=("run")
commands+=("stop") commands+=("stop")
commands+=("expose") commands+=("expose")
commands+=("label") commands+=("label")
......
...@@ -22,7 +22,7 @@ kubectl_port-forward.md ...@@ -22,7 +22,7 @@ kubectl_port-forward.md
kubectl_proxy.md kubectl_proxy.md
kubectl_resize.md kubectl_resize.md
kubectl_rolling-update.md kubectl_rolling-update.md
kubectl_run-container.md kubectl_run.md
kubectl_stop.md kubectl_stop.md
kubectl_update.md kubectl_update.md
kubectl_version.md kubectl_version.md
...@@ -47,7 +47,7 @@ See also issues with the following labels: ...@@ -47,7 +47,7 @@ See also issues with the following labels:
1. A fairly general-purpose way to specify fields on the command line during creation and update, not just from a config file 1. A fairly general-purpose way to specify fields on the command line during creation and update, not just from a config file
1. Extensible API-based generator framework (i.e. invoke generators via an API/URL rather than building them into kubectl), so that complex client libraries don’t need to be rewritten in multiple languages, and so that the abstractions are available through all interfaces: API, CLI, UI, logs, ... [#5280](https://github.com/GoogleCloudPlatform/kubernetes/issues/5280) 1. Extensible API-based generator framework (i.e. invoke generators via an API/URL rather than building them into kubectl), so that complex client libraries don’t need to be rewritten in multiple languages, and so that the abstractions are available through all interfaces: API, CLI, UI, logs, ... [#5280](https://github.com/GoogleCloudPlatform/kubernetes/issues/5280)
1. Need schema registry, and some way to invoke generator (e.g., using a container) 1. Need schema registry, and some way to invoke generator (e.g., using a container)
1. Convert run-container to API-based generator 1. Convert run command to API-based generator
1. Transformation framework 1. Transformation framework
1. More intelligent defaulting of fields (e.g., [#2643](https://github.com/GoogleCloudPlatform/kubernetes/issues/2643)) 1. More intelligent defaulting of fields (e.g., [#2643](https://github.com/GoogleCloudPlatform/kubernetes/issues/2643))
1. Update preconditions based on the values of arbitrary object fields. 1. Update preconditions based on the values of arbitrary object fields.
......
...@@ -191,7 +191,7 @@ NAME IMAGE(S SELECTOR REPLICAS ...@@ -191,7 +191,7 @@ NAME IMAGE(S SELECTOR REPLICAS
Start a container running nginx with a replication controller and three replicas Start a container running nginx with a replication controller and three replicas
``` ```
$ cluster/kubectl.sh run-container my-nginx --image=nginx --replicas=3 --port=80 $ cluster/kubectl.sh run my-nginx --image=nginx --replicas=3 --port=80
``` ```
When listing the pods, you will see that three containers have been started and are in Waiting state: When listing the pods, you will see that three containers have been started and are in Waiting state:
......
...@@ -46,7 +46,7 @@ The `kubectl.sh` line below spins up two containers running ...@@ -46,7 +46,7 @@ The `kubectl.sh` line below spins up two containers running
[Nginx](http://nginx.org/en/) running on port 80: [Nginx](http://nginx.org/en/) running on port 80:
```bash ```bash
cluster/kubectl.sh run-container my-nginx --image=nginx --replicas=2 --port=80 cluster/kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80
``` ```
To stop the containers: To stop the containers:
......
...@@ -18,7 +18,7 @@ If the status of any node is ```Unknown``` or ```NotReady``` your cluster is bro ...@@ -18,7 +18,7 @@ If the status of any node is ```Unknown``` or ```NotReady``` your cluster is bro
### Run an application ### Run an application
```sh ```sh
kubectl -s http://localhost:8080 run-container nginx --image=nginx --port=80 kubectl -s http://localhost:8080 run nginx --image=nginx --port=80
``` ```
now run ```docker ps``` you should see nginx running. You may need to wait a few minutes for the image to get pulled. now run ```docker ps``` you should see nginx running. You may need to wait a few minutes for the image to get pulled.
...@@ -31,7 +31,7 @@ kubectl expose rc nginx --port=80 ...@@ -31,7 +31,7 @@ kubectl expose rc nginx --port=80
This should print: This should print:
``` ```
NAME LABELS SELECTOR IP PORT(S) NAME LABELS SELECTOR IP PORT(S)
nginx <none> run-container=nginx <ip-addr> 80/TCP nginx <none> run=nginx <ip-addr> 80/TCP
``` ```
Hit the webserver: Hit the webserver:
......
...@@ -51,7 +51,7 @@ If you are running different kubernetes clusters, you may need to specify ```-s ...@@ -51,7 +51,7 @@ If you are running different kubernetes clusters, you may need to specify ```-s
### Run an application ### Run an application
```sh ```sh
kubectl -s http://localhost:8080 run-container nginx --image=nginx --port=80 kubectl -s http://localhost:8080 run nginx --image=nginx --port=80
``` ```
now run ```docker ps``` you should see nginx running. You may need to wait a few minutes for the image to get pulled. now run ```docker ps``` you should see nginx running. You may need to wait a few minutes for the image to get pulled.
...@@ -64,7 +64,7 @@ kubectl expose rc nginx --port=80 ...@@ -64,7 +64,7 @@ kubectl expose rc nginx --port=80
This should print: This should print:
``` ```
NAME LABELS SELECTOR IP PORT(S) NAME LABELS SELECTOR IP PORT(S)
nginx <none> run-container=nginx <ip-addr> 80/TCP nginx <none> run=nginx <ip-addr> 80/TCP
``` ```
Hit the webserver: Hit the webserver:
......
...@@ -47,7 +47,7 @@ You can now use any of the cluster/kubectl.sh commands to interact with your loc ...@@ -47,7 +47,7 @@ You can now use any of the cluster/kubectl.sh commands to interact with your loc
cluster/kubectl.sh get pods cluster/kubectl.sh get pods
cluster/kubectl.sh get services cluster/kubectl.sh get services
cluster/kubectl.sh get replicationcontrollers cluster/kubectl.sh get replicationcontrollers
cluster/kubectl.sh run-container my-nginx --image=nginx --replicas=2 --port=80 cluster/kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80
## begin wait for provision to complete, you can monitor the docker pull by opening a new terminal ## begin wait for provision to complete, you can monitor the docker pull by opening a new terminal
......
...@@ -164,7 +164,7 @@ NAME IMAGE(S SELECTOR REPLICAS ...@@ -164,7 +164,7 @@ NAME IMAGE(S SELECTOR REPLICAS
Start a container running nginx with a replication controller and three replicas Start a container running nginx with a replication controller and three replicas
```sh ```sh
$ ./cluster/kubectl.sh run-container my-nginx --image=nginx --replicas=3 --port=80 $ ./cluster/kubectl.sh run my-nginx --image=nginx --replicas=3 --port=80
``` ```
When listing the pods, you will see that three containers have been started and are in Waiting state: When listing the pods, you will see that three containers have been started and are in Waiting state:
......
...@@ -60,7 +60,7 @@ kubectl ...@@ -60,7 +60,7 @@ kubectl
* [kubectl proxy](kubectl_proxy.md) - Run a proxy to the Kubernetes API server * [kubectl proxy](kubectl_proxy.md) - Run a proxy to the Kubernetes API server
* [kubectl resize](kubectl_resize.md) - Set a new size for a Replication Controller. * [kubectl resize](kubectl_resize.md) - Set a new size for a Replication Controller.
* [kubectl rolling-update](kubectl_rolling-update.md) - Perform a rolling update of the given ReplicationController. * [kubectl rolling-update](kubectl_rolling-update.md) - Perform a rolling update of the given ReplicationController.
* [kubectl run-container](kubectl_run-container.md) - Run a particular image on the cluster. * [kubectl run](kubectl_run.md) - Run a particular image on the cluster.
* [kubectl stop](kubectl_stop.md) - Gracefully shut down a resource by id or filename. * [kubectl stop](kubectl_stop.md) - Gracefully shut down a resource by id or filename.
* [kubectl update](kubectl_update.md) - Update a resource by filename or stdin. * [kubectl update](kubectl_update.md) - Update a resource by filename or stdin.
* [kubectl version](kubectl_version.md) - Print the client and server version information. * [kubectl version](kubectl_version.md) - Print the client and server version information.
......
## kubectl run-container ## kubectl run
Run a particular image on the cluster. Run a particular image on the cluster.
...@@ -9,34 +9,34 @@ Create and run a particular image, possibly replicated. ...@@ -9,34 +9,34 @@ Create and run a particular image, possibly replicated.
Creates a replication controller to manage the created container(s). Creates a replication controller to manage the created container(s).
``` ```
kubectl run-container NAME --image=image [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] kubectl run NAME --image=image [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json]
``` ```
### Examples ### Examples
``` ```
// Starts a single instance of nginx. // Starts a single instance of nginx.
$ kubectl run-container nginx --image=nginx $ kubectl run nginx --image=nginx
// Starts a replicated instance of nginx. // Starts a replicated instance of nginx.
$ kubectl run-container nginx --image=nginx --replicas=5 $ kubectl run nginx --image=nginx --replicas=5
// Dry run. Print the corresponding API objects without creating them. // Dry run. Print the corresponding API objects without creating them.
$ kubectl run-container nginx --image=nginx --dry-run $ kubectl run nginx --image=nginx --dry-run
// Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON. // Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
$ kubectl run-container nginx --image=nginx --overrides='{ "apiVersion": "v1beta3", "spec": { ... } }' $ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1beta3", "spec": { ... } }'
``` ```
### Options ### Options
``` ```
--dry-run=false: If true, only print the object that would be sent, without sending it. --dry-run=false: If true, only print the object that would be sent, without sending it.
--generator="run-container/v1": The name of the API generator to use. Default is 'run-container-controller/v1'. --generator="run/v1": The name of the API generator to use. Default is 'run-controller/v1'.
-h, --help=false: help for run-container -h, --help=false: help for run
--hostport=-1: The host port mapping for the container port. To demonstrate a single-machine container. --hostport=-1: The host port mapping for the container port. To demonstrate a single-machine container.
--image="": The image for the container to run. --image="": The image for the container to run.
-l, --labels="": Labels to apply to the pod(s) created by this call to run-container. -l, --labels="": Labels to apply to the pod(s).
--no-headers=false: When using the default output, don't print headers. --no-headers=false: When using the default output, don't print headers.
-o, --output="": Output format. One of: json|yaml|template|templatefile. -o, --output="": Output format. One of: json|yaml|template|templatefile.
--output-version="": Output the formatted object with the given version (default api-version). --output-version="": Output the formatted object with the given version (default api-version).
...@@ -80,4 +80,4 @@ $ kubectl run-container nginx --image=nginx --overrides='{ "apiVersion": "v1beta ...@@ -80,4 +80,4 @@ $ kubectl run-container nginx --image=nginx --overrides='{ "apiVersion": "v1beta
###### Auto generated by spf13/cobra at 2015-05-21 10:33:11.189857293 +0000 UTC ###### Auto generated by spf13/cobra at 2015-05-21 10:33:11.189857293 +0000 UTC
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/kubectl_run-container.md?pixel)]() [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/kubectl_run.md?pixel)]()
...@@ -21,7 +21,7 @@ kubectl-port-forward.1 ...@@ -21,7 +21,7 @@ kubectl-port-forward.1
kubectl-proxy.1 kubectl-proxy.1
kubectl-resize.1 kubectl-resize.1
kubectl-rolling-update.1 kubectl-rolling-update.1
kubectl-run-container.1 kubectl-run.1
kubectl-stop.1 kubectl-stop.1
kubectl-update.1 kubectl-update.1
kubectl-version.1 kubectl-version.1
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
.SH NAME .SH NAME
.PP .PP
kubectl run\-container \- Run a particular image on the cluster. kubectl run \- Run a particular image on the cluster.
.SH SYNOPSIS .SH SYNOPSIS
.PP .PP
\fBkubectl run\-container\fP [OPTIONS] \fBkubectl run\fP [OPTIONS]
.SH DESCRIPTION .SH DESCRIPTION
...@@ -23,12 +23,12 @@ Creates a replication controller to manage the created container(s). ...@@ -23,12 +23,12 @@ Creates a replication controller to manage the created container(s).
If true, only print the object that would be sent, without sending it. If true, only print the object that would be sent, without sending it.
.PP .PP
\fB\-\-generator\fP="run\-container/v1" \fB\-\-generator\fP="run/v1"
The name of the API generator to use. Default is 'run\-container\-controller/v1'. The name of the API generator to use. Default is 'run\-controller/v1'.
.PP .PP
\fB\-h\fP, \fB\-\-help\fP=false \fB\-h\fP, \fB\-\-help\fP=false
help for run\-container help for run
.PP .PP
\fB\-\-hostport\fP=\-1 \fB\-\-hostport\fP=\-1
...@@ -40,7 +40,7 @@ Creates a replication controller to manage the created container(s). ...@@ -40,7 +40,7 @@ Creates a replication controller to manage the created container(s).
.PP .PP
\fB\-l\fP, \fB\-\-labels\fP="" \fB\-l\fP, \fB\-\-labels\fP=""
Labels to apply to the pod(s) created by this call to run\-container. Labels to apply to the pod(s).
.PP .PP
\fB\-\-no\-headers\fP=false \fB\-\-no\-headers\fP=false
...@@ -176,16 +176,16 @@ Creates a replication controller to manage the created container(s). ...@@ -176,16 +176,16 @@ Creates a replication controller to manage the created container(s).
.nf .nf
// Starts a single instance of nginx. // Starts a single instance of nginx.
$ kubectl run\-container nginx \-\-image=nginx $ kubectl run nginx \-\-image=nginx
// Starts a replicated instance of nginx. // Starts a replicated instance of nginx.
$ kubectl run\-container nginx \-\-image=nginx \-\-replicas=5 $ kubectl run nginx \-\-image=nginx \-\-replicas=5
// Dry run. Print the corresponding API objects without creating them. // Dry run. Print the corresponding API objects without creating them.
$ kubectl run\-container nginx \-\-image=nginx \-\-dry\-run $ kubectl run nginx \-\-image=nginx \-\-dry\-run
// Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON. // Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
$ kubectl run\-container nginx \-\-image=nginx \-\-overrides='\{ "apiVersion": "v1beta3", "spec": \{ ... \} \}' $ kubectl run nginx \-\-image=nginx \-\-overrides='\{ "apiVersion": "v1beta3", "spec": \{ ... \} \}'
.fi .fi
.RE .RE
......
...@@ -124,7 +124,7 @@ Find more information at ...@@ -124,7 +124,7 @@ Find more information at
.SH SEE ALSO .SH SEE ALSO
.PP .PP
\fBkubectl\-get(1)\fP, \fBkubectl\-describe(1)\fP, \fBkubectl\-create(1)\fP, \fBkubectl\-update(1)\fP, \fBkubectl\-delete(1)\fP, \fBkubectl\-namespace(1)\fP, \fBkubectl\-logs(1)\fP, \fBkubectl\-rolling\-update(1)\fP, \fBkubectl\-resize(1)\fP, \fBkubectl\-exec(1)\fP, \fBkubectl\-port\-forward(1)\fP, \fBkubectl\-proxy(1)\fP, \fBkubectl\-run\-container(1)\fP, \fBkubectl\-stop(1)\fP, \fBkubectl\-expose(1)\fP, \fBkubectl\-label(1)\fP, \fBkubectl\-config(1)\fP, \fBkubectl\-cluster\-info(1)\fP, \fBkubectl\-api\-versions(1)\fP, \fBkubectl\-version(1)\fP, \fBkubectl\-get(1)\fP, \fBkubectl\-describe(1)\fP, \fBkubectl\-create(1)\fP, \fBkubectl\-update(1)\fP, \fBkubectl\-delete(1)\fP, \fBkubectl\-namespace(1)\fP, \fBkubectl\-logs(1)\fP, \fBkubectl\-rolling\-update(1)\fP, \fBkubectl\-resize(1)\fP, \fBkubectl\-exec(1)\fP, \fBkubectl\-port\-forward(1)\fP, \fBkubectl\-proxy(1)\fP, \fBkubectl\-run(1)\fP, \fBkubectl\-stop(1)\fP, \fBkubectl\-expose(1)\fP, \fBkubectl\-label(1)\fP, \fBkubectl\-config(1)\fP, \fBkubectl\-cluster\-info(1)\fP, \fBkubectl\-api\-versions(1)\fP, \fBkubectl\-version(1)\fP,
.SH HISTORY .SH HISTORY
......
...@@ -36,7 +36,7 @@ The replication controller simply ensures that the desired number of pods matche ...@@ -36,7 +36,7 @@ The replication controller simply ensures that the desired number of pods matche
The replication controller is forever constrained to this narrow responsibility. It itself will not perform readiness nor liveness probes. Rather than performing auto-scaling, it is intended to be controlled by an external auto-scaler (as discussed in [#492](https://github.com/GoogleCloudPlatform/kubernetes/issues/492)), which would change its `replicas` field. We will not add scheduling policies (e.g., [spreading](https://github.com/GoogleCloudPlatform/kubernetes/issues/367#issuecomment-48428019)) to replication controller. Nor should it verify that the pods controlled match the currently specified template, as that would obstruct auto-sizing and other automated processes. Similarly, completion deadlines, ordering dependencies, configuration expansion, and other features belong elsewhere. We even plan to factor out the mechanism for bulk pod creation ([#170](https://github.com/GoogleCloudPlatform/kubernetes/issues/170)). The replication controller is forever constrained to this narrow responsibility. It itself will not perform readiness nor liveness probes. Rather than performing auto-scaling, it is intended to be controlled by an external auto-scaler (as discussed in [#492](https://github.com/GoogleCloudPlatform/kubernetes/issues/492)), which would change its `replicas` field. We will not add scheduling policies (e.g., [spreading](https://github.com/GoogleCloudPlatform/kubernetes/issues/367#issuecomment-48428019)) to replication controller. Nor should it verify that the pods controlled match the currently specified template, as that would obstruct auto-sizing and other automated processes. Similarly, completion deadlines, ordering dependencies, configuration expansion, and other features belong elsewhere. We even plan to factor out the mechanism for bulk pod creation ([#170](https://github.com/GoogleCloudPlatform/kubernetes/issues/170)).
The replication controller is intended to be a composable building-block primitive. We expect higher-level APIs and/or tools to be built on top of it and other complementary primitives for user convenience in the future. The "macro" operations currently supported by kubectl (run-container, stop, resize, rolling-update) are proof-of-concept examples of this. For instance, we could imagine something like [Asgard](http://techblog.netflix.com/2012/06/asgard-web-based-cloud-management-and.html) managing replication controllers, auto-scalers, services, scheduling policies, canaries, etc. The replication controller is intended to be a composable building-block primitive. We expect higher-level APIs and/or tools to be built on top of it and other complementary primitives for user convenience in the future. The "macro" operations currently supported by kubectl (run, stop, resize, rolling-update) are proof-of-concept examples of this. For instance, we could imagine something like [Asgard](http://techblog.netflix.com/2012/06/asgard-web-based-cloud-management-and.html) managing replication controllers, auto-scalers, services, scheduling policies, canaries, etc.
## Common usage patterns ## Common usage patterns
......
...@@ -184,7 +184,7 @@ At this point, all requests we make to the Kubernetes cluster from the command l ...@@ -184,7 +184,7 @@ At this point, all requests we make to the Kubernetes cluster from the command l
Let's create some content. Let's create some content.
```shell ```shell
$ cluster/kubectl.sh run-container snowflake --image=kubernetes/serve_hostname --replicas=2 $ cluster/kubectl.sh run snowflake --image=kubernetes/serve_hostname --replicas=2
``` ```
We have just created a replication controller whose replica size is 2 that is running the pod called snowflake with a basic container that just serves the hostname. We have just created a replication controller whose replica size is 2 that is running the pod called snowflake with a basic container that just serves the hostname.
...@@ -192,13 +192,13 @@ We have just created a replication controller whose replica size is 2 that is ru ...@@ -192,13 +192,13 @@ We have just created a replication controller whose replica size is 2 that is ru
```shell ```shell
cluster/kubectl.sh get rc cluster/kubectl.sh get rc
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
snowflake snowflake kubernetes/serve_hostname run-container=snowflake 2 snowflake snowflake kubernetes/serve_hostname run=snowflake 2
$ cluster/kubectl.sh get pods $ cluster/kubectl.sh get pods
POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS CREATED MESSAGE POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS CREATED MESSAGE
snowflake-mbrfi 10.244.2.4 kubernetes-minion-ilqx/104.197.8.214 run-container=snowflake Running About an hour snowflake-mbrfi 10.244.2.4 kubernetes-minion-ilqx/104.197.8.214 run=snowflake Running About an hour
snowflake kubernetes/serve_hostname Running About an hour snowflake kubernetes/serve_hostname Running About an hour
snowflake-p78ev 10.244.2.5 kubernetes-minion-ilqx/104.197.8.214 run-container=snowflake Running About an hour snowflake-p78ev 10.244.2.5 kubernetes-minion-ilqx/104.197.8.214 run=snowflake Running About an hour
snowflake kubernetes/serve_hostname Running About an hour snowflake kubernetes/serve_hostname Running About an hour
``` ```
...@@ -223,23 +223,23 @@ POD IP CONTAINER(S) IMAGE(S) ...@@ -223,23 +223,23 @@ POD IP CONTAINER(S) IMAGE(S)
Production likes to run cattle, so let's create some cattle pods. Production likes to run cattle, so let's create some cattle pods.
```shell ```shell
$ cluster/kubectl.sh run-container cattle --image=kubernetes/serve_hostname --replicas=5 $ cluster/kubectl.sh run cattle --image=kubernetes/serve_hostname --replicas=5
$ cluster/kubectl.sh get rc $ cluster/kubectl.sh get rc
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
cattle cattle kubernetes/serve_hostname run-container=cattle 5 cattle cattle kubernetes/serve_hostname run=cattle 5
$ cluster/kubectl.sh get pods $ cluster/kubectl.sh get pods
POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS CREATED MESSAGE POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS CREATED MESSAGE
cattle-1kyvj 10.244.0.4 kubernetes-minion-7s1y/23.236.54.97 run-container=cattle Running About an hour cattle-1kyvj 10.244.0.4 kubernetes-minion-7s1y/23.236.54.97 run=cattle Running About an hour
cattle kubernetes/serve_hostname Running About an hour cattle kubernetes/serve_hostname Running About an hour
cattle-kobrk 10.244.1.4 kubernetes-minion-cfs6/104.154.61.231 run-container=cattle Running About an hour cattle-kobrk 10.244.1.4 kubernetes-minion-cfs6/104.154.61.231 run=cattle Running About an hour
cattle kubernetes/serve_hostname Running About an hour cattle kubernetes/serve_hostname Running About an hour
cattle-l1v9t 10.244.0.5 kubernetes-minion-7s1y/23.236.54.97 run-container=cattle Running About an hour cattle-l1v9t 10.244.0.5 kubernetes-minion-7s1y/23.236.54.97 run=cattle Running About an hour
cattle kubernetes/serve_hostname Running About an hour cattle kubernetes/serve_hostname Running About an hour
cattle-ne2sj 10.244.3.7 kubernetes-minion-x8gx/104.154.47.83 run-container=cattle Running About an hour cattle-ne2sj 10.244.3.7 kubernetes-minion-x8gx/104.154.47.83 run=cattle Running About an hour
cattle kubernetes/serve_hostname Running About an hour cattle kubernetes/serve_hostname Running About an hour
cattle-qrk4x 10.244.0.6 kubernetes-minion-7s1y/23.236.54.97 run-container=cattle Running About an hour cattle-qrk4x 10.244.0.6 kubernetes-minion-7s1y/23.236.54.97 run=cattle Running About an hour
cattle kubernetes/serve_hostname cattle kubernetes/serve_hostname
``` ```
......
...@@ -12,7 +12,7 @@ The `kubectl` line below spins up two containers running ...@@ -12,7 +12,7 @@ The `kubectl` line below spins up two containers running
[Nginx](http://nginx.org/en/) running on port 80: [Nginx](http://nginx.org/en/) running on port 80:
```bash ```bash
kubectl run-container my-nginx --image=nginx --replicas=2 --port=80 kubectl run my-nginx --image=nginx --replicas=2 --port=80
``` ```
Once the pods are created, you can list them to see what is up and running: Once the pods are created, you can list them to see what is up and running:
......
...@@ -126,7 +126,7 @@ Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`, ...@@ -126,7 +126,7 @@ Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`,
cmds.AddCommand(NewCmdPortForward(f)) cmds.AddCommand(NewCmdPortForward(f))
cmds.AddCommand(NewCmdProxy(f, out)) cmds.AddCommand(NewCmdProxy(f, out))
cmds.AddCommand(NewCmdRunContainer(f, out)) cmds.AddCommand(NewCmdRun(f, out))
cmds.AddCommand(NewCmdStop(f, out)) cmds.AddCommand(NewCmdStop(f, out))
cmds.AddCommand(NewCmdExposeService(f, out)) cmds.AddCommand(NewCmdExposeService(f, out))
......
...@@ -173,7 +173,7 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) { ...@@ -173,7 +173,7 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) {
Validator: validation.NullSchema{}, Validator: validation.NullSchema{},
} }
generators := map[string]kubectl.Generator{ generators := map[string]kubectl.Generator{
"run-container/v1": kubectl.BasicReplicationController{}, "run/v1": kubectl.BasicReplicationController{},
"service/v1": kubectl.ServiceGenerator{}, "service/v1": kubectl.ServiceGenerator{},
} }
return &cmdutil.Factory{ return &cmdutil.Factory{
...@@ -245,7 +245,7 @@ func ExamplePrintReplicationController() { ...@@ -245,7 +245,7 @@ func ExamplePrintReplicationController() {
Codec: codec, Codec: codec,
Client: nil, Client: nil,
} }
cmd := NewCmdRunContainer(f, os.Stdout) cmd := NewCmdRun(f, os.Stdout)
ctrl := &api.ReplicationController{ ctrl := &api.ReplicationController{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "foo", Name: "foo",
......
...@@ -19,6 +19,7 @@ package cmd ...@@ -19,6 +19,7 @@ package cmd
import ( import (
"fmt" "fmt"
"io" "io"
"os"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl"
...@@ -30,31 +31,33 @@ const ( ...@@ -30,31 +31,33 @@ const (
run_long = `Create and run a particular image, possibly replicated. run_long = `Create and run a particular image, possibly replicated.
Creates a replication controller to manage the created container(s).` Creates a replication controller to manage the created container(s).`
run_example = `// Starts a single instance of nginx. run_example = `// Starts a single instance of nginx.
$ kubectl run-container nginx --image=nginx $ kubectl run nginx --image=nginx
// Starts a replicated instance of nginx. // Starts a replicated instance of nginx.
$ kubectl run-container nginx --image=nginx --replicas=5 $ kubectl run nginx --image=nginx --replicas=5
// Dry run. Print the corresponding API objects without creating them. // Dry run. Print the corresponding API objects without creating them.
$ kubectl run-container nginx --image=nginx --dry-run $ kubectl run nginx --image=nginx --dry-run
// Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON. // Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
$ kubectl run-container nginx --image=nginx --overrides='{ "apiVersion": "v1beta3", "spec": { ... } }'` $ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1beta3", "spec": { ... } }'`
) )
func NewCmdRunContainer(f *cmdutil.Factory, out io.Writer) *cobra.Command { func NewCmdRun(f *cmdutil.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "run-container NAME --image=image [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json]", Use: "run NAME --image=image [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json]",
// run-container is deprecated
Aliases: []string{"run-container"},
Short: "Run a particular image on the cluster.", Short: "Run a particular image on the cluster.",
Long: run_long, Long: run_long,
Example: run_example, Example: run_example,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := RunRunContainer(f, out, cmd, args) err := Run(f, out, cmd, args)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)
}, },
} }
cmdutil.AddPrinterFlags(cmd) cmdutil.AddPrinterFlags(cmd)
cmd.Flags().String("generator", "run-container/v1", "The name of the API generator to use. Default is 'run-container-controller/v1'.") cmd.Flags().String("generator", "run/v1", "The name of the API generator to use. Default is 'run-controller/v1'.")
cmd.Flags().String("image", "", "The image for the container to run.") cmd.Flags().String("image", "", "The image for the container to run.")
cmd.MarkFlagRequired("image") cmd.MarkFlagRequired("image")
cmd.Flags().IntP("replicas", "r", 1, "Number of replicas to create for this container. Default is 1.") cmd.Flags().IntP("replicas", "r", 1, "Number of replicas to create for this container. Default is 1.")
...@@ -62,13 +65,17 @@ func NewCmdRunContainer(f *cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -62,13 +65,17 @@ func NewCmdRunContainer(f *cmdutil.Factory, out io.Writer) *cobra.Command {
cmd.Flags().String("overrides", "", "An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.") cmd.Flags().String("overrides", "", "An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.")
cmd.Flags().Int("port", -1, "The port that this container exposes.") cmd.Flags().Int("port", -1, "The port that this container exposes.")
cmd.Flags().Int("hostport", -1, "The host port mapping for the container port. To demonstrate a single-machine container.") cmd.Flags().Int("hostport", -1, "The host port mapping for the container port. To demonstrate a single-machine container.")
cmd.Flags().StringP("labels", "l", "", "Labels to apply to the pod(s) created by this call to run-container.") cmd.Flags().StringP("labels", "l", "", "Labels to apply to the pod(s).")
return cmd return cmd
} }
func RunRunContainer(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error { func Run(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error {
if os.Args[1] == "run-container" {
printDeprecationWarning("run", "run-container")
}
if len(args) != 1 { if len(args) != 1 {
return cmdutil.UsageError(cmd, "NAME is required for run-container") return cmdutil.UsageError(cmd, "NAME is required for run")
} }
namespace, err := f.DefaultNamespace() namespace, err := f.DefaultNamespace()
......
...@@ -93,7 +93,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { ...@@ -93,7 +93,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
flags.SetNormalizeFunc(util.WarnWordSepNormalizeFunc) // Warn for "_" flags flags.SetNormalizeFunc(util.WarnWordSepNormalizeFunc) // Warn for "_" flags
generators := map[string]kubectl.Generator{ generators := map[string]kubectl.Generator{
"run-container/v1": kubectl.BasicReplicationController{}, "run/v1": kubectl.BasicReplicationController{},
"service/v1": kubectl.ServiceGenerator{}, "service/v1": kubectl.ServiceGenerator{},
} }
......
...@@ -49,7 +49,7 @@ func (BasicReplicationController) Generate(params map[string]string) (runtime.Ob ...@@ -49,7 +49,7 @@ func (BasicReplicationController) Generate(params map[string]string) (runtime.Ob
} }
} else { } else {
labels = map[string]string{ labels = map[string]string{
"run-container": params["name"], "run": params["name"],
} }
} }
count, err := strconv.Atoi(params["replicas"]) count, err := strconv.Atoi(params["replicas"])
......
...@@ -39,14 +39,14 @@ func TestGenerate(t *testing.T) { ...@@ -39,14 +39,14 @@ func TestGenerate(t *testing.T) {
expected: &api.ReplicationController{ expected: &api.ReplicationController{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "foo", Name: "foo",
Labels: map[string]string{"run-container": "foo"}, Labels: map[string]string{"run": "foo"},
}, },
Spec: api.ReplicationControllerSpec{ Spec: api.ReplicationControllerSpec{
Replicas: 1, Replicas: 1,
Selector: map[string]string{"run-container": "foo"}, Selector: map[string]string{"run": "foo"},
Template: &api.PodTemplateSpec{ Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Labels: map[string]string{"run-container": "foo"}, Labels: map[string]string{"run": "foo"},
}, },
Spec: api.PodSpec{ Spec: api.PodSpec{
Containers: []api.Container{ Containers: []api.Container{
...@@ -70,14 +70,14 @@ func TestGenerate(t *testing.T) { ...@@ -70,14 +70,14 @@ func TestGenerate(t *testing.T) {
expected: &api.ReplicationController{ expected: &api.ReplicationController{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "foo", Name: "foo",
Labels: map[string]string{"run-container": "foo"}, Labels: map[string]string{"run": "foo"},
}, },
Spec: api.ReplicationControllerSpec{ Spec: api.ReplicationControllerSpec{
Replicas: 1, Replicas: 1,
Selector: map[string]string{"run-container": "foo"}, Selector: map[string]string{"run": "foo"},
Template: &api.PodTemplateSpec{ Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Labels: map[string]string{"run-container": "foo"}, Labels: map[string]string{"run": "foo"},
}, },
Spec: api.PodSpec{ Spec: api.PodSpec{
Containers: []api.Container{ Containers: []api.Container{
...@@ -107,14 +107,14 @@ func TestGenerate(t *testing.T) { ...@@ -107,14 +107,14 @@ func TestGenerate(t *testing.T) {
expected: &api.ReplicationController{ expected: &api.ReplicationController{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "foo", Name: "foo",
Labels: map[string]string{"run-container": "foo"}, Labels: map[string]string{"run": "foo"},
}, },
Spec: api.ReplicationControllerSpec{ Spec: api.ReplicationControllerSpec{
Replicas: 1, Replicas: 1,
Selector: map[string]string{"run-container": "foo"}, Selector: map[string]string{"run": "foo"},
Template: &api.PodTemplateSpec{ Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Labels: map[string]string{"run-container": "foo"}, Labels: map[string]string{"run": "foo"},
}, },
Spec: api.PodSpec{ Spec: api.PodSpec{
Containers: []api.Container{ Containers: []api.Container{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment