Skip to content

Commit 311385e

Browse files
committed
Make deployment the default in kubectl run
1 parent 2874f30 commit 311385e

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

docs/man/man1/kubectl-run.1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ kubectl run \- Run a particular image on the cluster.
1414
.SH DESCRIPTION
1515
.PP
1616
Create and run a particular image, possibly replicated.
17-
Creates a replication controller or job to manage the created container(s).
17+
Creates a deployment or job to manage the created container(s).
1818

1919

2020
.SH OPTIONS
@@ -40,7 +40,7 @@ Creates a replication controller or job to manage the created container(s).
4040

4141
.PP
4242
\fB\-\-generator\fP=""
43-
The name of the API generator to use. Default is 'run/v1' if \-\-restart=Always, otherwise the default is 'job/v1beta1'.
43+
The name of the API generator to use. Default is 'deployment/v1beta1' if \-\-restart=Always, otherwise the default is 'job/v1beta1'.
4444

4545
.PP
4646
\fB\-\-hostport\fP=\-1
@@ -98,7 +98,7 @@ Creates a replication controller or job to manage the created container(s).
9898

9999
.PP
100100
\fB\-\-restart\fP="Always"
101-
The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a replication controller is created for this pod, if set to OnFailure or Never, a job is created for this pod and \-\-replicas must be 1. Default 'Always'
101+
The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and \-\-replicas must be 1. Default 'Always'
102102

103103
.PP
104104
\fB\-\-rm\fP=false
@@ -256,7 +256,7 @@ $ kubectl run nginx \-\-image=nginx \-\-replicas=5
256256
# Dry run. Print the corresponding API objects without creating them.
257257
$ kubectl run nginx \-\-image=nginx \-\-dry\-run
258258

259-
# Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
259+
# Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
260260
$ kubectl run nginx \-\-image=nginx \-\-overrides='{ "apiVersion": "v1", "spec": { ... } }'
261261

262262
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.

docs/user-guide/deployments.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Documentation for other releases can be found at
3939

4040
- [Deployments](#deployments)
4141
- [What is a _Deployment_?](#what-is-a-deployment)
42-
- [Enabling Deployments on a Kubernetes cluster](#enabling-deployments-on-a-kubernetes-cluster)
4342
- [Creating a Deployment](#creating-a-deployment)
4443
- [Updating a Deployment](#updating-a-deployment)
4544
- [Multiple Updates](#multiple-updates)

docs/user-guide/kubectl/kubectl_run.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Run a particular image on the cluster.
4040

4141

4242
Create and run a particular image, possibly replicated.
43-
Creates a replication controller or job to manage the created container(s).
43+
Creates a deployment or job to manage the created container(s).
4444

4545
```
4646
kubectl run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]
@@ -64,7 +64,7 @@ $ kubectl run nginx --image=nginx --replicas=5
6464
# Dry run. Print the corresponding API objects without creating them.
6565
$ kubectl run nginx --image=nginx --dry-run
6666
67-
# Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
67+
# Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
6868
$ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
6969
7070
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
@@ -88,7 +88,7 @@ $ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'pri
8888
--dry-run[=false]: If true, only print the object that would be sent, without sending it.
8989
--env=[]: Environment variables to set in the container
9090
--expose[=false]: If true, a public, external service is created for the container(s) which are run
91-
--generator="": The name of the API generator to use. Default is 'run/v1' if --restart=Always, otherwise the default is 'job/v1beta1'.
91+
--generator="": The name of the API generator to use. Default is 'deployment/v1beta1' if --restart=Always, otherwise the default is 'job/v1beta1'.
9292
--hostport=-1: The host port mapping for the container port. To demonstrate a single-machine container.
9393
--image="": The image for the container to run.
9494
-l, --labels="": Labels to apply to the pod(s).
@@ -102,7 +102,7 @@ $ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'pri
102102
--record[=false]: Record current kubectl command in the resource annotation.
103103
-r, --replicas=1: Number of replicas to create for this container. Default is 1.
104104
--requests="": The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'
105-
--restart="Always": The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a replication controller is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'
105+
--restart="Always": The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'
106106
--rm[=false]: If true, delete resources created in this command for attached containers.
107107
--save-config[=false]: If true, the configuration of current object will be saved in its annotation. This is useful when you want to perform kubectl apply on this object in the future.
108108
--service-generator="service/v2": The name of the generator to use for creating a service. Only used if --expose is true
@@ -147,7 +147,7 @@ $ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'pri
147147

148148
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
149149

150-
###### Auto generated by spf13/cobra on 22-Jan-2016
150+
###### Auto generated by spf13/cobra on 2-Feb-2016
151151

152152
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
153153
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_run.md?pixel)]()

pkg/kubectl/cmd/run.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434

3535
const (
3636
run_long = `Create and run a particular image, possibly replicated.
37-
Creates a replication controller or job to manage the created container(s).`
37+
Creates a deployment or job to manage the created container(s).`
3838
run_example = `# Start a single instance of nginx.
3939
$ kubectl run nginx --image=nginx
4040
@@ -50,7 +50,7 @@ $ kubectl run nginx --image=nginx --replicas=5
5050
# Dry run. Print the corresponding API objects without creating them.
5151
$ kubectl run nginx --image=nginx --dry-run
5252
53-
# Start a single instance of nginx, but overload the spec of the replication controller with a partial set of values parsed from JSON.
53+
# Start a single instance of nginx, but overload the spec of the deployment with a partial set of values parsed from JSON.
5454
$ kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
5555
5656
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
@@ -88,8 +88,7 @@ func NewCmdRun(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *c
8888
}
8989

9090
func addRunFlags(cmd *cobra.Command) {
91-
// TODO: Change the default to "deployment/v1beta1" (which is a valid generator) when deployment reaches beta (#15313)
92-
cmd.Flags().String("generator", "", "The name of the API generator to use. Default is 'run/v1' if --restart=Always, otherwise the default is 'job/v1beta1'.")
91+
cmd.Flags().String("generator", "", "The name of the API generator to use. Default is 'deployment/v1beta1' if --restart=Always, otherwise the default is 'job/v1beta1'.")
9392
cmd.Flags().String("image", "", "The image for the container to run.")
9493
cmd.MarkFlagRequired("image")
9594
cmd.Flags().IntP("replicas", "r", 1, "Number of replicas to create for this container. Default is 1.")
@@ -104,7 +103,7 @@ func addRunFlags(cmd *cobra.Command) {
104103
cmd.Flags().Bool("tty", false, "Allocated a TTY for each container in the pod. Because -t is currently shorthand for --template, -t is not supported for --tty. This shorthand is deprecated and we expect to adopt -t for --tty soon.")
105104
cmd.Flags().Bool("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.")
106105
cmd.Flags().Bool("leave-stdin-open", false, "If the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach completes.")
107-
cmd.Flags().String("restart", "Always", "The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a replication controller is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'")
106+
cmd.Flags().String("restart", "Always", "The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'")
108107
cmd.Flags().Bool("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.")
109108
cmd.Flags().String("requests", "", "The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'")
110109
cmd.Flags().String("limits", "", "The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'")
@@ -147,9 +146,8 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob
147146

148147
generatorName := cmdutil.GetFlagString(cmd, "generator")
149148
if len(generatorName) == 0 {
150-
// TODO: Change the default to "deployment/v1beta1" when deployment reaches beta (#15313)
151149
if restartPolicy == api.RestartPolicyAlways {
152-
generatorName = "run/v1"
150+
generatorName = "deployment/v1beta1"
153151
} else {
154152
generatorName = "job/v1beta1"
155153
}

0 commit comments

Comments
 (0)