Skip to content
This repository was archived by the owner on Oct 7, 2019. It is now read-only.

Commit 101159e

Browse files
committed
Create step9.md
1 parent 57a584a commit 101159e

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

step9.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 9. Roll out an upgrade to your app
2+
3+
Estimated time: 13 min remaining
4+
5+
As always, the application you deployed to production requires bug fixes or additional features.
6+
Kubernetes is here to help you deploy a new version to production without impacting your users.
7+
8+
First, let’s modify the application. In the cloud console, edit `server.js` and update the response message:
9+
```javascript
10+
response.end("Hello Kubernetes World!");
11+
```
12+
13+
We can now build and publish a new container image to the registry with an incremented tag:
14+
```sh
15+
$ docker build -t gcr.io/PROJECT_ID/hello-node:v2 .
16+
$ gcloud docker push gcr.io/PROJECT_ID/hello-node:v2
17+
```
18+
19+
**Note**: Building and pushing this updated image should be much quicker as we take full advantage of the Docker cache.
20+
21+
We’re now ready for kubernetes to smoothly update our replication controller to the new version of the application:
22+
```sh
23+
$ kubectl rolling-update hello-node \
24+
--image=gcr.io/PROJECT_ID/hello-node:v2 \
25+
--update-period=2s
26+
Creating hello-node-324d23dd3e0e2474d6b76dc599abb519
27+
At beginning of loop: hello-node replicas: 2, hello-node-324d23dd3e0e2474d6b76dc599abb519 replicas: 1
28+
...
29+
At end of loop: hello-node replicas: 0, hello-node-324d23dd3e0e2474d6b76dc599abb519 replicas: 3
30+
Update succeeded. Deleting old controller: hello-node
31+
Renaming hello-node-324d23dd3e0e2474d6b76dc599abb519 to hello-node
32+
hello-node
33+
```
34+
You should see in the standard output how the rolling update actually works:
35+
36+
1. A new replication controller is created based on the new image
37+
1. The replica count on the new and old controllers is increased/decreased by one respectively until the desired number of
38+
replicas is reached
39+
1. The original replication controller is deleted
40+
41+
While this is happening, the users of the services should not see any interruption. After a little while they will start
42+
accessing the new version of your application. You can find more details on rolling updates in
43+
[this documentation](https://cloud.google.com/container-engine/docs/rolling-updates).
44+
45+
Hopefully with these deployment, scaling and update features you’ll agree that once you’ve setup your environment (your GKE/Kubernetes cluster here), Kubernetes is here to help you focus on the application rather than the infrastructure.
46+
47+
#### [Go to step 10](step10.md)
48+
#### [Go back to step 8](step8.md)

0 commit comments

Comments
 (0)