mirror of https://github.com/k3s-io/k3s
Merge pull request #1398 from jbeda/update-readme-tweak
Tweak instructions for update demopull/6/head
commit
791e2185e1
|
@ -21,7 +21,7 @@ This example demonstrates the usage of Kubernetes to perform a live update on a
|
|||
|
||||
This example assumes that you have forked the repository and [turned up a Kubernetes cluster](https://github.com/GoogleCloudPlatform/kubernetes-new#contents):
|
||||
|
||||
```shell
|
||||
```bash
|
||||
$ cd kubernetes
|
||||
$ hack/dev-build-and-up.sh
|
||||
```
|
||||
|
@ -29,44 +29,56 @@ $ hack/dev-build-and-up.sh
|
|||
This example also assumes that you have [Docker](http://docker.io) installed on your local machine.
|
||||
|
||||
It also assumes that `$DOCKER_HUB_USER` is set to your Docker user id. We use this to upload the docker images that are used in the demo.
|
||||
```bash
|
||||
$ export DOCKER_HUB_USER=my-docker-id
|
||||
```
|
||||
|
||||
You may need to open the firewall for port 8080 using the [console][cloud-console] or the `gcutil` tool. The following command will allow traffic from any source to instances tagged `kubernetes-minion`:
|
||||
|
||||
```shell
|
||||
```bash
|
||||
$ gcutil addfirewall --allowed=tcp:8080 --target_tags=kubernetes-minion kubernetes-minion-8080
|
||||
```
|
||||
|
||||
### Step Zero: Build the image
|
||||
### Step Zero: Build the Docker images
|
||||
|
||||
```shell
|
||||
This can take a few minutes to download/upload stuff.
|
||||
|
||||
```bash
|
||||
$ cd examples/update-demo
|
||||
$ ./0-build-images.sh
|
||||
```
|
||||
|
||||
### Step One: Turn up the UX for the demo
|
||||
|
||||
```shell
|
||||
$ ./1-run-web-proxy.sh &
|
||||
```
|
||||
You can use bash job control to run this in the background. This can sometimes spew to the output so you could also run it in a different terminal.
|
||||
|
||||
This can sometimes spew to the output so you could also run it in a different terminal.
|
||||
```
|
||||
$ ./1-run-web-proxy.sh &
|
||||
Running local proxy to Kubernetes API Server. Run this in a
|
||||
separate terminal or run it in the background.
|
||||
|
||||
http://localhost:8001/static/
|
||||
|
||||
+ ../../cluster/kubecfg.sh -proxy -www local/
|
||||
I0922 11:43:54.886018 15659 kubecfg.go:209] Starting to serve on localhost:8001
|
||||
```
|
||||
|
||||
Now visit the the [demo website](http://localhost:8001/static). You won't see anything much quite yet.
|
||||
|
||||
### Step Two: Run the controller
|
||||
Now we will turn up two replicas of an image. They all serve on port 8080, mapped to internal port 80
|
||||
|
||||
```shell
|
||||
```bash
|
||||
$ ./2-create-replication-controller.sh
|
||||
```
|
||||
|
||||
After these pull the image (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.
|
||||
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 resizing the controller
|
||||
|
||||
Now we will increase the number of replicas from two to four:
|
||||
|
||||
```shell
|
||||
```bash
|
||||
$ ./3-scale.sh
|
||||
```
|
||||
|
||||
|
@ -75,7 +87,7 @@ If you go back to the [demo website](http://localhost:8001/static/index.html) yo
|
|||
### 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
|
||||
```bash
|
||||
$ ./4-rolling-update
|
||||
```
|
||||
The rollingUpdate command in kubecfg will do 2 things:
|
||||
|
@ -87,7 +99,7 @@ Watch the UX, it will update one pod every 10 seconds until all of the pods have
|
|||
|
||||
### Step Five: Bring down the pods
|
||||
|
||||
```shell
|
||||
```bash
|
||||
$ ./5-down.sh
|
||||
```
|
||||
|
||||
|
@ -99,11 +111,22 @@ This will first 'stop' the replication controller by turning the target number o
|
|||
|
||||
To turn down a Kubernetes cluster:
|
||||
|
||||
```shell
|
||||
```bash
|
||||
$ cd ../.. # Up to kubernetes.
|
||||
$ cluster/kube-down.sh
|
||||
```
|
||||
|
||||
Kill the proxy running in the background:
|
||||
After you are done running this demo make sure to kill it:
|
||||
|
||||
```bash
|
||||
$ jobs
|
||||
[1]+ Running ./1-run-web-proxy.sh &
|
||||
$ kill %1
|
||||
[1]+ Terminated: 15 ./1-run-web-proxy.sh
|
||||
```
|
||||
|
||||
|
||||
### Image Copyright
|
||||
|
||||
Note that he images included here are public domain.
|
||||
|
|
Loading…
Reference in New Issue