You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: web/guestbook-go/README.md
+36-36Lines changed: 36 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
## Guestbook Example
2
2
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.
4
4
5
5
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).
6
6
@@ -24,25 +24,25 @@ This example assumes that you have a working cluster. See the [Getting Started G
24
24
25
25
### Step One: Create the Redis master pod<aid="step-one"></a>
26
26
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).
28
28
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:
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):
Result: The replication controller then creates the single Redis master pod.
45
+
Result: The deployment then creates the single Redis master pod.
46
46
47
47
3. To verify that the redis-master pod is running, list the pods you created in cluster with the `kubectl get pods` command:
48
48
@@ -94,29 +94,29 @@ Services find the pods to load balance based on pod labels. The pod that you cre
94
94
95
95
### Step Three: Create the Redis replica pods <a id="step-three"></a>
96
96
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.
98
98
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:
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`).
117
117
118
118
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:
120
120
121
121
```console
122
122
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
@@ -162,25 +162,25 @@ Tip: It is helpful to set labels on your services themselves--as we've done here
162
162
163
163
### Step Five: Create the guestbook pods <a id="step-five"></a>
164
164
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.
166
166
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:
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.
175
175
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:
@@ -193,8 +193,8 @@ This is a simple Go `net/http` ([negroni](https://github.com/codegangsta/negroni
193
193
guestbook-gv7i6 1/1 Running 0 2m
194
194
guestbook-x405a 1/1 Running 0 2m
195
195
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
198
198
...
199
199
```
200
200
@@ -204,10 +204,10 @@ This is a simple Go `net/http` ([negroni](https://github.com/codegangsta/negroni
204
204
205
205
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"`.
206
206
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:
@@ -248,15 +248,15 @@ You can now play with the guestbook that you just created by opening it in a bro
248
248
249
249
### Step Eight: Cleanup <a id="step-eight"></a>
250
250
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.
252
252
253
253
Delete all the resources by running the following `kubectl delete -f` *`filename`* command:
0 commit comments