From b65d0a30c971d7cbd974dec9a0680d729dc69a16 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 15 Mar 2017 17:31:38 -0700 Subject: [PATCH] Move Guide topic: Rolling Update Demo (#2850) * Move Guide topic: Rolling Update Demo * rename file --- docs/concepts/overview/what-is-kubernetes.md | 2 +- .../rolling-update-replication-controller.md | 4 +- docs/user-guide/deployments.md | 2 +- docs/user-guide/index.md | 2 +- docs/user-guide/update-demo/index.md | 105 +---------------- docs/user-guide/update-demo/index.md.orig | 107 ++++++++++++++++++ 6 files changed, 114 insertions(+), 108 deletions(-) create mode 100644 docs/user-guide/update-demo/index.md.orig diff --git a/docs/concepts/overview/what-is-kubernetes.md b/docs/concepts/overview/what-is-kubernetes.md index 8a9d5b04db..378a1f2c47 100644 --- a/docs/concepts/overview/what-is-kubernetes.md +++ b/docs/concepts/overview/what-is-kubernetes.md @@ -74,7 +74,7 @@ Kubernetes satisfies a number of common needs of applications running in product * [horizontal auto-scaling](/docs/user-guide/horizontal-pod-autoscaling/), * [naming and discovery](/docs/user-guide/connecting-applications/), * [load balancing](/docs/user-guide/services/), -* [rolling updates](/docs/user-guide/update-demo/), +* [rolling updates](/docs/tasks/run-application/rolling-update-replication-controller/), * [resource monitoring](/docs/user-guide/monitoring/), * [log access and ingestion](/docs/user-guide/logging/overview/), * [support for introspection and debugging](/docs/user-guide/introspection-and-debugging/), and diff --git a/docs/tasks/run-application/rolling-update-replication-controller.md b/docs/tasks/run-application/rolling-update-replication-controller.md index 19aadec01a..ae64d478a6 100644 --- a/docs/tasks/run-application/rolling-update-replication-controller.md +++ b/docs/tasks/run-application/rolling-update-replication-controller.md @@ -9,7 +9,7 @@ title: Rolling Update Replication Controller ## Overview -To update a service without an outage, `kubectl` supports what is called ['rolling update'](/docs/user-guide/kubectl/kubectl_rolling-update), which updates one pod at a time, rather than taking down the entire service at the same time. See the [rolling update design document](https://github.com/kubernetes/kubernetes/blob/{{page.githubbranch}}/docs/design/simple-rolling-update.md) and the [example of rolling update](/docs/user-guide/update-demo/) for more information. +To update a service without an outage, `kubectl` supports what is called ['rolling update'](/docs/user-guide/kubectl/kubectl_rolling-update), which updates one pod at a time, rather than taking down the entire service at the same time. See the [rolling update design document](https://github.com/kubernetes/kubernetes/blob/{{page.githubbranch}}/docs/design/simple-rolling-update.md) and the [example of rolling update](/docs/tasks/run-application/rolling-update-replication-controller/) for more information. Note that `kubectl rolling-update` only supports Replication Controllers. However, if you deploy applications with Replication Controllers, consider switching them to [Deployments](/docs/user-guide/deployments/). A Deployment is a higher-level controller that automates rolling updates @@ -242,7 +242,7 @@ Update succeeded. Deleting old controller: my-nginx replicationcontroller "my-nginx-v4" rolling updated ``` -You can also run the [update demo](/docs/user-guide/update-demo/) to see a visual representation of the rolling update process. +You can also run the [update demo](/docs/tasks/run-application/rolling-update-replication-controller/) to see a visual representation of the rolling update process. ## Troubleshooting diff --git a/docs/user-guide/deployments.md b/docs/user-guide/deployments.md index a55d1dd255..7610384eab 100644 --- a/docs/user-guide/deployments.md +++ b/docs/user-guide/deployments.md @@ -778,7 +778,7 @@ All existing Pods are killed before new ones are created when #### Rolling Update Deployment -The Deployment updates Pods in a [rolling update](/docs/user-guide/update-demo/) fashion +The Deployment updates Pods in a [rolling update](/docs/tasks/run-application/rolling-update-replication-controller/) fashion when `.spec.strategy.type==RollingUpdate`. You can specify `maxUnavailable` and `maxSurge` to control the rolling update process. diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index d7d7891142..c62ff4574c 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -87,6 +87,6 @@ Pods and containers * [Migrating from docker-cli to kubectl](/docs/user-guide/docker-cli-to-kubectl/) * [Configuration Best Practices and Tips](/docs/user-guide/config-best-practices/) * [Assign pods to selected nodes](/docs/user-guide/node-selection/) - * [Perform a rolling update on a running group of pods](/docs/user-guide/update-demo/) + * [Perform a rolling update on a running group of pods](/docs/tasks/run-application/rolling-update-replication-controller/) [Developer Guide]: https://github.com/kubernetes/community/blob/master/contributors/devel/README.md diff --git a/docs/user-guide/update-demo/index.md b/docs/user-guide/update-demo/index.md index 14bf74ee1f..610c884f24 100644 --- a/docs/user-guide/update-demo/index.md +++ b/docs/user-guide/update-demo/index.md @@ -1,107 +1,6 @@ --- -assignees: -- mikedanese title: Rolling Update Demo --- -This example demonstrates the usage of Kubernetes to perform a [rolling update](/docs/user-guide/kubectl/kubectl_rolling-update/) on a running group of [pods](/docs/user-guide/pods/). See [here](/docs/concepts/cluster-administration/manage-deployment/#updating-your-application-without-a-service-outage) to understand why you need a rolling update. Also check [rolling update design document](https://github.com/kubernetes/kubernetes/blob/{{page.githubbranch}}/docs/design/simple-rolling-update.md) for more information. - -The files for this example are viewable in [our docs repo -here](https://github.com/kubernetes/kubernetes.github.io/tree/{{page.docsbranch}}/docs/user-guide/update-demo). - -### Step Zero: Prerequisites - -This example assumes that you have forked the docs repository and [turned up a Kubernetes cluster](/docs/getting-started-guides/): - -```shell -$ git clone -b {{page.docsbranch}} https://github.com/kubernetes/kubernetes.github.io -$ cd kubernetes.github.io -``` - -### Step One: Turn up the UX for the demo - -You can use bash job control to run this in the background (note that you must use the default port -- 8001 -- for the following demonstration to work properly). -This can sometimes spew to the output so you could also run it in a different terminal. You have to run `kubectl proxy` in the root of the -Kubernetes repository. Otherwise you will get "404 page not found" errors as the paths will not match. You can find more information about `kubectl proxy` -[here](/docs/user-guide/kubectl/kubectl_proxy). - -```shell -$ kubectl proxy --www=docs/user-guide/update-demo/local/ & -I0218 15:18:31.623279 67480 proxy.go:36] Starting to serve on localhost:8001 -``` - -Now visit the [demo website](http://localhost:8001/static). You won't see anything much quite yet. - -### Step Two: Run the replication controller - -Now we will turn up two replicas of an [image](/docs/user-guide/images/). They all serve on internal port 80. - -```shell -$ kubectl create -f docs/user-guide/update-demo/nautilus-rc.yaml -``` - -After pulling the image from the Docker Hub to your worker nodes (which may take a minute or so) you'll see a couple of squares in the UI detailing the pods that are running along with the image that they are serving up. A cute little nautilus. - -### Step Three: Try scaling the replication controller - -Now we will increase the number of replicas from two to four: - -```shell -$ kubectl scale rc update-demo-nautilus --replicas=4 -``` - -If you go back to the [demo website](http://localhost:8001/static/index.html) you should eventually see four boxes, one for each pod. - -### Step Four: Update the docker image - -We will now update the docker image to serve a different image by doing a rolling update to a new Docker image. - -```shell -$ kubectl rolling-update update-demo-nautilus --update-period=10s -f docs/user-guide/update-demo/kitten-rc.yaml -``` - -The rolling-update command in kubectl will do 2 things: - -1. Create a new [replication controller](/docs/user-guide/replication-controller/) with a pod template that uses the new image (`gcr.io/google_containers/update-demo:kitten`) -2. Scale the old and new replication controllers until the new controller replaces the old. This will kill the current pods one at a time, spinning up new ones to replace them. - -Watch the [demo website](http://localhost:8001/static/index.html), it will update one pod every 10 seconds until all of the pods have the new image. -Note that the new replication controller definition does not include the replica count, so the current replica count of the old replication controller is preserved. -But if the replica count had been specified, the final replica count of the new replication controller will be equal to this number. - -### Step Five: Bring down the pods - -```shell -$ kubectl delete rc update-demo-kitten -``` - -This first stops the replication controller by turning the target number of replicas to 0 and then deletes the controller. - -### Step Six: Cleanup - -After you are done running this demo make sure to kill the proxy running in the background: - -```shell -$ jobs -[1]+ Running ./kubectl proxy --www=local/ & -$ kill %1 -[1]+ Terminated: 15 ./kubectl proxy --www=local/ -``` - -### Updating the Docker images - -If you want to build your own docker images, you can set `$DOCKER_HUB_USER` to your Docker user id and run the included shell script. It can take a few minutes to download/upload stuff. - -```shell -$ export DOCKER_HUB_USER=my-docker-id -$ ./docs/user-guide/update-demo/build-images.sh -``` - -To use your custom docker image in the above examples, you will need to change the image name in `docs/user-guide/update-demo/nautilus-rc.yaml` and `docs/user-guide/update-demo/kitten-rc.yaml`. - -### Image Copyright - -Note that the images included here are public domain. - -* [kitten](http://commons.wikimedia.org/wiki/File:Kitten-stare.jpg) -* [nautilus](http://commons.wikimedia.org/wiki/File:Nautilus_pompilius.jpg) +{% include user-guide-content-moved.md %} +[Rolling Update Replication Controller](/docs/tasks/run-application/rolling-update-replication-controller/) diff --git a/docs/user-guide/update-demo/index.md.orig b/docs/user-guide/update-demo/index.md.orig new file mode 100644 index 0000000000..14bf74ee1f --- /dev/null +++ b/docs/user-guide/update-demo/index.md.orig @@ -0,0 +1,107 @@ +--- +assignees: +- mikedanese +title: Rolling Update Demo +--- + +This example demonstrates the usage of Kubernetes to perform a [rolling update](/docs/user-guide/kubectl/kubectl_rolling-update/) on a running group of [pods](/docs/user-guide/pods/). See [here](/docs/concepts/cluster-administration/manage-deployment/#updating-your-application-without-a-service-outage) to understand why you need a rolling update. Also check [rolling update design document](https://github.com/kubernetes/kubernetes/blob/{{page.githubbranch}}/docs/design/simple-rolling-update.md) for more information. + +The files for this example are viewable in [our docs repo +here](https://github.com/kubernetes/kubernetes.github.io/tree/{{page.docsbranch}}/docs/user-guide/update-demo). + +### Step Zero: Prerequisites + +This example assumes that you have forked the docs repository and [turned up a Kubernetes cluster](/docs/getting-started-guides/): + +```shell +$ git clone -b {{page.docsbranch}} https://github.com/kubernetes/kubernetes.github.io +$ cd kubernetes.github.io +``` + +### Step One: Turn up the UX for the demo + +You can use bash job control to run this in the background (note that you must use the default port -- 8001 -- for the following demonstration to work properly). +This can sometimes spew to the output so you could also run it in a different terminal. You have to run `kubectl proxy` in the root of the +Kubernetes repository. Otherwise you will get "404 page not found" errors as the paths will not match. You can find more information about `kubectl proxy` +[here](/docs/user-guide/kubectl/kubectl_proxy). + +```shell +$ kubectl proxy --www=docs/user-guide/update-demo/local/ & +I0218 15:18:31.623279 67480 proxy.go:36] Starting to serve on localhost:8001 +``` + +Now visit the [demo website](http://localhost:8001/static). You won't see anything much quite yet. + +### Step Two: Run the replication controller + +Now we will turn up two replicas of an [image](/docs/user-guide/images/). They all serve on internal port 80. + +```shell +$ kubectl create -f docs/user-guide/update-demo/nautilus-rc.yaml +``` + +After pulling the image from the Docker Hub to your worker nodes (which may take a minute or so) you'll see a couple of squares in the UI detailing the pods that are running along with the image that they are serving up. A cute little nautilus. + +### Step Three: Try scaling the replication controller + +Now we will increase the number of replicas from two to four: + +```shell +$ kubectl scale rc update-demo-nautilus --replicas=4 +``` + +If you go back to the [demo website](http://localhost:8001/static/index.html) you should eventually see four boxes, one for each pod. + +### Step Four: Update the docker image + +We will now update the docker image to serve a different image by doing a rolling update to a new Docker image. + +```shell +$ kubectl rolling-update update-demo-nautilus --update-period=10s -f docs/user-guide/update-demo/kitten-rc.yaml +``` + +The rolling-update command in kubectl will do 2 things: + +1. Create a new [replication controller](/docs/user-guide/replication-controller/) with a pod template that uses the new image (`gcr.io/google_containers/update-demo:kitten`) +2. Scale the old and new replication controllers until the new controller replaces the old. This will kill the current pods one at a time, spinning up new ones to replace them. + +Watch the [demo website](http://localhost:8001/static/index.html), it will update one pod every 10 seconds until all of the pods have the new image. +Note that the new replication controller definition does not include the replica count, so the current replica count of the old replication controller is preserved. +But if the replica count had been specified, the final replica count of the new replication controller will be equal to this number. + +### Step Five: Bring down the pods + +```shell +$ kubectl delete rc update-demo-kitten +``` + +This first stops the replication controller by turning the target number of replicas to 0 and then deletes the controller. + +### Step Six: Cleanup + +After you are done running this demo make sure to kill the proxy running in the background: + +```shell +$ jobs +[1]+ Running ./kubectl proxy --www=local/ & +$ kill %1 +[1]+ Terminated: 15 ./kubectl proxy --www=local/ +``` + +### Updating the Docker images + +If you want to build your own docker images, you can set `$DOCKER_HUB_USER` to your Docker user id and run the included shell script. It can take a few minutes to download/upload stuff. + +```shell +$ export DOCKER_HUB_USER=my-docker-id +$ ./docs/user-guide/update-demo/build-images.sh +``` + +To use your custom docker image in the above examples, you will need to change the image name in `docs/user-guide/update-demo/nautilus-rc.yaml` and `docs/user-guide/update-demo/kitten-rc.yaml`. + +### Image Copyright + +Note that the images included here are public domain. + +* [kitten](http://commons.wikimedia.org/wiki/File:Kitten-stare.jpg) +* [nautilus](http://commons.wikimedia.org/wiki/File:Nautilus_pompilius.jpg)