Skip to content

Commit 72c1752

Browse files
committed
update README to reflect Deployment changes
1 parent cb0bfbe commit 72c1752

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

web/guestbook-go/README.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Guestbook Example
22

3-
This example shows how to build a simple multi-tier web application using Kubernetes and Docker. The application consists of a web front end, Redis master for storage, and replicated set of Redis replicas, all for which we will create Kubernetes replication controllers, pods, and services.
3+
This example shows how to build a simple multi-tier web application using Kubernetes and Docker. The application consists of a web front end, Redis master for storage, and replicated set of Redis replicas, all for which we will create Kubernetes deployments, pods, and services.
44

55
If you are running a cluster in Google Container Engine (GKE), instead see the [Guestbook Example for Google Container Engine](https://cloud.google.com/container-engine/docs/tutorials/guestbook).
66

@@ -24,25 +24,25 @@ This example assumes that you have a working cluster. See the [Getting Started G
2424

2525
### Step One: Create the Redis master pod<a id="step-one"></a>
2626

27-
Use the `examples/guestbook-go/redis-master-controller.yaml` file to create a [replication controller](https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/) and Redis master [pod](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/). The pod runs a Redis key-value server in a container. Using a replication controller is the preferred way to launch long-running pods, even for 1 replica, so that the pod benefits from the self-healing mechanism in Kubernetes (keeps the pods alive).
27+
Use the `examples/guestbook-go/redis-master-controller.yaml` file to create a [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) and Redis master [pod](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/). The pod runs a Redis key-value server in a container. Using a deployment is the preferred way to launch long-running pods, even for 1 replica, so that the pod benefits from the self-healing mechanism in Kubernetes (keeps the pods alive).
2828

29-
1. Use the [redis-master-controller.yaml](redis-master-controller.yaml) file to create the Redis master replication controller in your Kubernetes cluster by running the `kubectl create -f` *`filename`* command:
29+
1. Use the [redis-master-controller.yaml](redis-master-controller.yaml) file to create the Redis master deployment in your Kubernetes cluster by running the `kubectl apply -f` *`filename`* command:
3030

3131
```console
32-
$ kubectl create -f guestbook-go/redis-master-controller.yaml
32+
$ kubectl apply -f guestbook-go/redis-master-controller.yaml
3333
3434
```
3535

36-
2. To verify that the redis-master controller is up, list the replication controllers you created in the cluster with the `kubectl get rc` command(if you don't specify a `--namespace`, the `default` namespace will be used. The same below):
36+
2. To verify that the redis-master controller is up, list the deployments you created in the cluster with the `kubectl get deployments` command(if you don't specify a `--namespace`, the `default` namespace will be used. The same below):
3737

3838
```console
39-
$ kubectl get rc
40-
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
41-
redis-master redis-master gurpartap/redis app=redis,role=master 1
39+
$ kubectl get deployments
40+
NAME READY UP-TO-DATE AVAILABLE AGE
41+
redis-master 1/1 1 1 26m
4242
...
4343
```
4444

45-
Result: The replication controller then creates the single Redis master pod.
45+
Result: The deployment then creates the single Redis master pod.
4646

4747
3. To verify that the redis-master pod is running, list the pods you created in cluster with the `kubectl get pods` command:
4848

@@ -94,29 +94,29 @@ Services find the pods to load balance based on pod labels. The pod that you cre
9494

9595
### Step Three: Create the Redis replica pods <a id="step-three"></a>
9696

97-
The Redis master we created earlier is a single pod (REPLICAS = 1), while the Redis read replicas we are creating here are 'replicated' pods. In Kubernetes, a replication controller is responsible for managing the multiple instances of a replicated pod.
97+
The Redis master we created earlier is a single pod (REPLICAS = 1), while the Redis read replicas we are creating here are 'replicated' pods. In Kubernetes, a deployment is responsible for managing the multiple instances of a replicated pod.
9898

99-
1. Use the file [redis-replica-controller.yaml](redis-replica-controller.yaml) to create the replication controller by running the `kubectl create -f` *`filename`* command:
99+
1. Use the file [redis-replica-controller.yaml](redis-replica-controller.yaml) to create the deployment by running the `kubectl apply -f` *`filename`* command:
100100

101101
```console
102-
$ kubectl create -f guestbook-go/redis-replica-controller.yaml
102+
$ kubectl apply -f guestbook-go/redis-replica-controller.yaml
103103
104104
```
105105

106-
2. To verify that the redis-replica controller is running, run the `kubectl get rc` command:
106+
2. To verify that the redis-replica controller is running, run the `kubectl get deployments` command:
107107

108108
```console
109-
$ kubectl get rc
110-
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
111-
redis-master redis-master redis app=redis,role=master 1
112-
redis-replica redis-replica registry.k8s.io/redis-slave:v2 app=redis,role=replica 2
109+
$ kubectl get deployments
110+
NAME READY UP-TO-DATE AVAILABLE AGE
111+
redis-master 1/1 1 1 28m
112+
redis-replica 2/2 2 2 10m
113113
...
114114
```
115115

116-
Result: The replication controller creates and configures the Redis replica pods through the redis-master service (name:port pair, in our example that's `redis-master:6379`).
116+
Result: The deployment creates and configures the Redis replica pods through the redis-master service (name:port pair, in our example that's `redis-master:6379`).
117117

118118
Example:
119-
The Redis replicas get started by the replication controller with the following command:
119+
The Redis replicas get started by the deployment with the following command:
120120

121121
```console
122122
redis-server --replicaof redis-master 6379
@@ -152,7 +152,7 @@ Just like the master, we want to have a service to proxy connections to the read
152152
$ kubectl get services
153153
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
154154
redis-master 10.0.136.3 <none> 6379/TCP app=redis,role=master 1h
155-
redis-replica 10.0.21.92 <none> 6379/TCP app-redis,role=replica 1h
155+
redis-replica 10.0.21.92 <none> 6379/TCP app=redis,role=replica 1h
156156
...
157157
```
158158

@@ -162,25 +162,25 @@ Tip: It is helpful to set labels on your services themselves--as we've done here
162162

163163
### Step Five: Create the guestbook pods <a id="step-five"></a>
164164

165-
This is a simple Go `net/http` ([negroni](https://github.com/codegangsta/negroni) based) server that is configured to talk to either the replica or master services depending on whether the request is a read or a write. The pods we are creating expose a simple JSON interface and serves a jQuery-Ajax based UI. Like the Redis replica pods, these pods are also managed by a replication controller.
165+
This is a simple Go `net/http` ([negroni](https://github.com/codegangsta/negroni) based) server that is configured to talk to either the replica or master services depending on whether the request is a read or a write. The pods we are creating expose a simple JSON interface and serves a jQuery-Ajax based UI. Like the Redis replica pods, these pods are also managed by a deployment.
166166

167-
1. Use the [guestbook-controller.yaml](guestbook-controller.yaml) file to create the guestbook replication controller by running the `kubectl create -f` *`filename`* command:
167+
1. Use the [guestbook-controller.yaml](guestbook-controller.yaml) file to create the guestbook deployment by running the `kubectl apply -f` *`filename`* command:
168168

169169
```console
170-
$ kubectl create -f guestbook-go/guestbook-controller.yaml
170+
$ kubectl apply -f guestbook-go/guestbook-controller.yaml
171171
172172
```
173173

174174
Tip: If you want to modify the guestbook code open the `_src` of this example and read the README.md and the Makefile. If you have pushed your custom image be sure to update the `image` accordingly in the guestbook-controller.yaml.
175175

176-
2. To verify that the guestbook replication controller is running, run the `kubectl get rc` command:
176+
2. To verify that the guestbook deployment is running, run the `kubectl get deployment` command:
177177

178178
```console
179-
$ kubectl get rc
180-
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
181-
guestbook guestbook registry.k8s.io/guestbook:v3 app=guestbook 3
182-
redis-master redis-master redis app=redis,role=master 1
183-
redis-replica redis-replica registry.k8s.io/redis-replica:v2 app=redis,role=replica 2
179+
$ kubectl get deployment
180+
NAME READY UP-TO-DATE AVAILABLE AGE
181+
guestbook 3/3 3 3 2m
182+
redis-master 1/1 1 1 23m
183+
redis-replica 2/2 2 2 6m
184184
...
185185
```
186186

@@ -193,8 +193,8 @@ This is a simple Go `net/http` ([negroni](https://github.com/codegangsta/negroni
193193
guestbook-gv7i6 1/1 Running 0 2m
194194
guestbook-x405a 1/1 Running 0 2m
195195
redis-master-xx4uv 1/1 Running 0 23m
196-
redis-replica-b6wj4 1/1 Running 0 6m
197-
redis-replica-iai40 1/1 Running 0 6m
196+
redis-replica-b6wj4 1/1 Running 0 6m
197+
redis-replica-iai40 1/1 Running 0 6m
198198
...
199199
```
200200

@@ -204,10 +204,10 @@ This is a simple Go `net/http` ([negroni](https://github.com/codegangsta/negroni
204204

205205
Just like the others, we create a service to group the guestbook pods but this time, to make the guestbook front end externally visible, we specify `"type": "LoadBalancer"`.
206206

207-
1. Use the [guestbook-service.yaml](guestbook-service.yaml) file to create the guestbook service by running the `kubectl create -f` *`filename`* command:
207+
1. Use the [guestbook-service.yaml](guestbook-service.yaml) file to create the guestbook service by running the `kubectl apply -f` *`filename`* command:
208208

209209
```console
210-
$ kubectl create -f guestbook-go/guestbook-service.yaml
210+
$ kubectl apply -f guestbook-go/guestbook-service.yaml
211211
```
212212

213213

@@ -218,7 +218,7 @@ Just like the others, we create a service to group the guestbook pods but this t
218218
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
219219
guestbook 10.0.217.218 146.148.81.8 3000/TCP app=guestbook 1h
220220
redis-master 10.0.136.3 <none> 6379/TCP app=redis,role=master 1h
221-
redis-replica 10.0.21.92 <none> 6379/TCP app-redis,role=replica 1h
221+
redis-replica 10.0.21.92 <none> 6379/TCP app=redis,role=replica 1h
222222
...
223223
```
224224

@@ -248,15 +248,15 @@ You can now play with the guestbook that you just created by opening it in a bro
248248

249249
### Step Eight: Cleanup <a id="step-eight"></a>
250250

251-
After you're done playing with the guestbook, you can cleanup by deleting the guestbook service and removing the associated resources that were created, including load balancers, forwarding rules, target pools, and Kubernetes replication controllers and services.
251+
After you're done playing with the guestbook, you can cleanup by deleting the guestbook service and removing the associated resources that were created, including load balancers, forwarding rules, target pools, and Kubernetes deployments and services.
252252

253253
Delete all the resources by running the following `kubectl delete -f` *`filename`* command:
254254

255255
```console
256256
$ kubectl delete -f guestbook-go
257257
guestbook-controller
258258
guestbook
259-
redid-master-controller
259+
redis-master-controller
260260
redis-master
261261
redis-replica-controller
262262
redis-replica

0 commit comments

Comments
 (0)