fix the command output (#9955)

I have verified on version v1.11
This commit is contained in:
tanshanshan
2018-08-21 22:24:33 +08:00
committed by k8s-ci-robot
parent d895efe24e
commit c5a07419f2
@@ -28,8 +28,8 @@ Multiple resources can be created the same way as a single resource:
```shell ```shell
$ kubectl create -f https://k8s.io/examples/application/nginx-app.yaml $ kubectl create -f https://k8s.io/examples/application/nginx-app.yaml
service "my-nginx-svc" created service/my-nginx-svc created
deployment "my-nginx" created deployment.apps/my-nginx created
``` ```
The resources will be created in the order they appear in the file. Therefore, it's best to specify the service first, since that will ensure the scheduler can spread the pods associated with the service as they are created by the controller(s), such as Deployment. The resources will be created in the order they appear in the file. Therefore, it's best to specify the service first, since that will ensure the scheduler can spread the pods associated with the service as they are created by the controller(s), such as Deployment.
@@ -54,7 +54,7 @@ A URL can also be specified as a configuration source, which is handy for deploy
```shell ```shell
$ kubectl create -f https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/application/nginx/nginx-deployment.yaml $ kubectl create -f https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/application/nginx/nginx-deployment.yaml
deployment "my-nginx" created deployment.apps/my-nginx created
``` ```
## Bulk operations in kubectl ## Bulk operations in kubectl
@@ -77,7 +77,7 @@ For larger numbers of resources, you'll find it easier to specify the selector (
```shell ```shell
$ kubectl delete deployment,services -l app=nginx $ kubectl delete deployment,services -l app=nginx
deployment "my-nginx" deleted deployment.apps "my-nginx" deleted
service "my-nginx-svc" deleted service "my-nginx-svc" deleted
``` ```
@@ -85,8 +85,8 @@ Because `kubectl` outputs resource names in the same syntax it accepts, it's eas
```shell ```shell
$ kubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service) $ kubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service)
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
my-nginx-svc 10.0.0.208 <pending> 80/TCP 0s my-nginx-svc LoadBalancer 10.0.0.208 <pending> 80/TCP 0s
``` ```
With the above commands, we first create resources under `examples/application/nginx/` and print the resources created with `-o name` output format With the above commands, we first create resources under `examples/application/nginx/` and print the resources created with `-o name` output format
@@ -242,9 +242,9 @@ For example, if you want to label all your nginx pods as frontend tier, simply r
```shell ```shell
$ kubectl label pods -l app=nginx tier=fe $ kubectl label pods -l app=nginx tier=fe
pod "my-nginx-2035384211-j5fhi" labeled pod/my-nginx-2035384211-j5fhi labeled
pod "my-nginx-2035384211-u2c7e" labeled pod/my-nginx-2035384211-u2c7e labeled
pod "my-nginx-2035384211-u3t6x" labeled pod/my-nginx-2035384211-u3t6x labeled
``` ```
This first filters all pods with the label "app=nginx", and then labels them with the "tier=fe". This first filters all pods with the label "app=nginx", and then labels them with the "tier=fe".
@@ -285,7 +285,7 @@ When load on your application grows or shrinks, it's easy to scale with `kubectl
```shell ```shell
$ kubectl scale deployment/my-nginx --replicas=1 $ kubectl scale deployment/my-nginx --replicas=1
deployment "my-nginx" scaled deployment.extensions/my-nginx scaled
``` ```
Now you only have one pod managed by the deployment. Now you only have one pod managed by the deployment.
@@ -300,7 +300,7 @@ To have the system automatically choose the number of nginx replicas as needed,
```shell ```shell
$ kubectl autoscale deployment/my-nginx --min=1 --max=3 $ kubectl autoscale deployment/my-nginx --min=1 --max=3
deployment "my-nginx" autoscaled horizontalpodautoscaler.autoscaling/my-nginx autoscaled
``` ```
Now your nginx replicas will be scaled up and down as needed, automatically. Now your nginx replicas will be scaled up and down as needed, automatically.
@@ -322,7 +322,7 @@ This command will compare the version of the configuration that you're pushing w
```shell ```shell
$ kubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml $ kubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml
deployment "my-nginx" configured deployment.apps/my-nginx configured
``` ```
Note that `kubectl apply` attaches an annotation to the resource in order to determine the changes to the configuration since the previous invocation. When it's invoked, `kubectl apply` does a three-way diff between the previous configuration, the provided input and the current configuration of the resource, in order to determine how to modify the resource. Note that `kubectl apply` attaches an annotation to the resource in order to determine the changes to the configuration since the previous invocation. When it's invoked, `kubectl apply` does a three-way diff between the previous configuration, the provided input and the current configuration of the resource, in order to determine how to modify the resource.
@@ -350,7 +350,7 @@ $ kubectl get deployment my-nginx -o yaml > /tmp/nginx.yaml
$ vi /tmp/nginx.yaml $ vi /tmp/nginx.yaml
# do some edit, and then save the file # do some edit, and then save the file
$ kubectl apply -f /tmp/nginx.yaml $ kubectl apply -f /tmp/nginx.yaml
deployment "my-nginx" configured deployment.apps/my-nginx configured
$ rm /tmp/nginx.yaml $ rm /tmp/nginx.yaml
``` ```
@@ -372,8 +372,8 @@ In some cases, you may need to update resource fields that cannot be updated onc
```shell ```shell
$ kubectl replace -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml --force $ kubectl replace -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml --force
deployment "my-nginx" deleted deployment.apps/my-nginx deleted
deployment "my-nginx" replaced deployment.apps/my-nginx replaced
``` ```
## Updating your application without a service outage ## Updating your application without a service outage
@@ -387,7 +387,7 @@ Let's say you were running version 1.7.9 of nginx:
```shell ```shell
$ kubectl run my-nginx --image=nginx:1.7.9 --replicas=3 $ kubectl run my-nginx --image=nginx:1.7.9 --replicas=3
deployment "my-nginx" created deployment.apps/my-nginx created
``` ```
To update to version 1.9.1, simply change `.spec.template.spec.containers[0].image` from `nginx:1.7.9` to `nginx:1.9.1`, with the kubectl commands we learned above. To update to version 1.9.1, simply change `.spec.template.spec.containers[0].image` from `nginx:1.7.9` to `nginx:1.9.1`, with the kubectl commands we learned above.