Skip to content

Commit 2b1e860

Browse files
authored
Merge pull request #421 from EmilyM1/update-language-yaml
Update language yaml
2 parents 02f71e3 + 4504af7 commit 2b1e860

File tree

13 files changed

+81
-81
lines changed

13 files changed

+81
-81
lines changed

guestbook-go/README.md

Lines changed: 32 additions & 32 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 slaves, 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 replication controllers, 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

@@ -9,8 +9,8 @@ If you are running a cluster in Google Container Engine (GKE), instead see the [
99
* [Step Zero: Prerequisites](#step-zero)
1010
* [Step One: Create the Redis master pod](#step-one)
1111
* [Step Two: Create the Redis master service](#step-two)
12-
* [Step Three: Create the Redis slave pods](#step-three)
13-
* [Step Four: Create the Redis slave service](#step-four)
12+
* [Step Three: Create the Redis replica pods](#step-three)
13+
* [Step Four: Create the Redis replica service](#step-four)
1414
* [Step Five: Create the guestbook pods](#step-five)
1515
* [Step Six: Create the guestbook service](#step-six)
1616
* [Step Seven: View the guestbook](#step-seven)
@@ -92,77 +92,77 @@ Services find the pods to load balance based on pod labels. The pod that you cre
9292
Result: All new pods will see the `redis-master` service running on the host (`$REDIS_MASTER_SERVICE_HOST` environment variable) at port 6379, or running on `redis-master:6379`. After the service is created, the service proxy on each node is configured to set up a proxy on the specified port (in our example, that's port 6379).
9393

9494

95-
### Step Three: Create the Redis slave pods <a id="step-three"></a>
95+
### 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 slaves 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 replication controller is responsible for managing the multiple instances of a replicated pod.
9898

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

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

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

108108
```console
109109
$ kubectl get rc
110110
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
111111
redis-master redis-master redis app=redis,role=master 1
112-
redis-slave redis-slave k8s.gcr.io/redis-slave:v2 app=redis,role=slave 2
112+
redis-replica redis-replica k8s.gcr.io/redis-slave:v2 app=redis,role=replica 2
113113
...
114114
```
115115

116-
Result: The replication controller creates and configures the Redis slave pods through the redis-master service (name:port pair, in our example that's `redis-master:6379`).
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`).
117117

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

121121
```console
122-
redis-server --slaveof redis-master 6379
122+
redis-server --replicaof redis-master 6379
123123
```
124124

125-
3. To verify that the Redis master and slaves pods are running, run the `kubectl get pods` command:
125+
3. To verify that the Redis master and replicas pods are running, run the `kubectl get pods` command:
126126

127127
```console
128128
$ kubectl get pods
129129
NAME READY STATUS RESTARTS AGE
130130
redis-master-xx4uv 1/1 Running 0 18m
131-
redis-slave-b6wj4 1/1 Running 0 1m
132-
redis-slave-iai40 1/1 Running 0 1m
131+
redis-replica-b6wj4 1/1 Running 0 1m
132+
redis-replica-iai40 1/1 Running 0 1m
133133
...
134134
```
135135

136-
Result: You see the single Redis master and two Redis slave pods.
136+
Result: You see the single Redis master and two Redis replica pods.
137137

138-
### Step Four: Create the Redis slave service <a id="step-four"></a>
138+
### Step Four: Create the Redis replica service <a id="step-four"></a>
139139

140-
Just like the master, we want to have a service to proxy connections to the read slaves. In this case, in addition to discovery, the Redis slave service provides transparent load balancing to clients.
140+
Just like the master, we want to have a service to proxy connections to the read replicas. In this case, in addition to discovery, the Redis replica service provides transparent load balancing to clients.
141141

142-
1. Use the [redis-slave-service.json](redis-slave-service.json) file to create the Redis slave service by running the `kubectl create -f` *`filename`* command:
142+
1. Use the [redis-replica-service.json](redis-replica-service.json) file to create the Redis replica service by running the `kubectl create -f` *`filename`* command:
143143

144144
```console
145-
$ kubectl create -f examples/guestbook-go/redis-slave-service.json
145+
$ kubectl create -f examples/guestbook-go/redis-replica-service.json
146146
147147
```
148148

149-
2. To verify that the redis-slave service is up, list the services you created in the cluster with the `kubectl get services` command:
149+
2. To verify that the redis-replica service is up, list the services you created in the cluster with the `kubectl get services` command:
150150

151151
```console
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-slave 10.0.21.92 <none> 6379/TCP app-redis,role=slave 1h
155+
redis-replica 10.0.21.92 <none> 6379/TCP app-redis,role=replica 1h
156156
...
157157
```
158158

159-
Result: The service is created with labels `app=redis` and `role=slave` to identify that the pods are running the Redis slaves.
159+
Result: The service is created with labels `app=redis` and `role=replica` to identify that the pods are running the Redis replicas.
160160

161161
Tip: It is helpful to set labels on your services themselves--as we've done here--to make it easy to locate them later.
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 slave 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 slave 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 replication controller.
166166

167167
1. Use the [guestbook-controller.json](guestbook-controller.json) file to create the guestbook replication controller by running the `kubectl create -f` *`filename`* command:
168168

@@ -178,9 +178,9 @@ This is a simple Go `net/http` ([negroni](https://github.com/codegangsta/negroni
178178
```console
179179
$ kubectl get rc
180180
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
181-
guestbook guestbook k8s.gcr.io/guestbook:v3 app=guestbook 3
181+
guestbook guestbook k8s.gcr.io/guestbook:v3 app=guestbook 3
182182
redis-master redis-master redis app=redis,role=master 1
183-
redis-slave redis-slave k8s.gcr.io/redis-slave:v2 app=redis,role=slave 2
183+
redis-replica redis-replica k8s.gcr.io/redis-replica:v2 app=redis,role=replica 2
184184
...
185185
```
186186

@@ -193,12 +193,12 @@ 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-slave-b6wj4 1/1 Running 0 6m
197-
redis-slave-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

201-
Result: You see a single Redis master, two Redis slaves, and three guestbook pods.
201+
Result: You see a single Redis master, two Redis replicas, and three guestbook pods.
202202

203203
### Step Six: Create the guestbook service <a id="step-six"></a>
204204

@@ -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-slave 10.0.21.92 <none> 6379/TCP app-redis,role=slave 1h
221+
redis-replica 10.0.21.92 <none> 6379/TCP app-redis,role=replica 1h
222222
...
223223
```
224224

@@ -258,8 +258,8 @@ guestbook-controller
258258
guestbook
259259
redid-master-controller
260260
redis-master
261-
redis-slave-controller
262-
redis-slave
261+
redis-replica-controller
262+
redis-replica
263263
```
264264

265265
Tip: To turn down your Kubernetes cluster, follow the corresponding instructions in the version of the

guestbook-go/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ import (
2929

3030
var (
3131
masterPool *simpleredis.ConnectionPool
32-
slavePool *simpleredis.ConnectionPool
32+
replicaPool *simpleredis.ConnectionPool
3333
)
3434

3535
func ListRangeHandler(rw http.ResponseWriter, req *http.Request) {
3636
key := mux.Vars(req)["key"]
37-
list := simpleredis.NewList(slavePool, key)
37+
list := simpleredis.NewList(replicaPool, key)
3838
members := HandleError(list.GetAll()).([]string)
3939
membersJSON := HandleError(json.MarshalIndent(members, "", " ")).([]byte)
4040
rw.Write(membersJSON)
@@ -76,8 +76,8 @@ func HandleError(result interface{}, err error) (r interface{}) {
7676
func main() {
7777
masterPool = simpleredis.NewConnectionPoolHost("redis-master:6379")
7878
defer masterPool.Close()
79-
slavePool = simpleredis.NewConnectionPoolHost("redis-slave:6379")
80-
defer slavePool.Close()
79+
replicaPool = simpleredis.NewConnectionPoolHost("redis-replica:6379")
80+
defer replicaPool.Close()
8181

8282
r := mux.NewRouter()
8383
r.Path("/lrange/{key}").Methods("GET").HandlerFunc(ListRangeHandler)

guestbook-go/redis-slave-controller.json renamed to guestbook-go/redis-replica-controller.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22
"kind":"ReplicationController",
33
"apiVersion":"v1",
44
"metadata":{
5-
"name":"redis-slave",
5+
"name":"redis-replica",
66
"labels":{
77
"app":"redis",
8-
"role":"slave"
8+
"role":"replica"
99
}
1010
},
1111
"spec":{
1212
"replicas":2,
1313
"selector":{
1414
"app":"redis",
15-
"role":"slave"
15+
"role":"replica"
1616
},
1717
"template":{
1818
"metadata":{
1919
"labels":{
2020
"app":"redis",
21-
"role":"slave"
21+
"role":"replica"
2222
}
2323
},
2424
"spec":{
2525
"containers":[
2626
{
27-
"name":"redis-slave",
27+
"name":"redis-replica",
2828
"image":"k8s.gcr.io/redis-slave:v2",
2929
"ports":[
3030
{

guestbook-go/redis-slave-service.json renamed to guestbook-go/redis-replica-service.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"kind":"Service",
33
"apiVersion":"v1",
44
"metadata":{
5-
"name":"redis-slave",
5+
"name":"redis-replica",
66
"labels":{
77
"app":"redis",
8-
"role":"slave"
8+
"role":"replica"
99
}
1010
},
1111
"spec":{
@@ -17,7 +17,7 @@
1717
],
1818
"selector":{
1919
"app":"redis",
20-
"role":"slave"
20+
"role":"replica"
2121
}
2222
}
2323
}

guestbook/all-in-one/guestbook-all-in-one.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,39 +46,39 @@ spec:
4646
apiVersion: v1
4747
kind: Service
4848
metadata:
49-
name: redis-slave
49+
name: redis-replica
5050
labels:
5151
app: redis
5252
tier: backend
53-
role: slave
53+
role: replica
5454
spec:
5555
ports:
5656
- port: 6379
5757
selector:
5858
app: redis
5959
tier: backend
60-
role: slave
60+
role: replica
6161
---
6262
apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
6363
kind: Deployment
6464
metadata:
65-
name: redis-slave
65+
name: redis-replica
6666
spec:
6767
selector:
6868
matchLabels:
6969
app: redis
70-
role: slave
70+
role: replica
7171
tier: backend
7272
replicas: 2
7373
template:
7474
metadata:
7575
labels:
7676
app: redis
77-
role: slave
77+
role: replica
7878
tier: backend
7979
spec:
8080
containers:
81-
- name: slave
81+
- name: replica
8282
image: gcr.io/google_samples/gb-redisslave:v1
8383
resources:
8484
requests:
@@ -104,7 +104,7 @@ metadata:
104104
tier: frontend
105105
spec:
106106
# comment or delete the following line if you want to use a LoadBalancer
107-
type: NodePort
107+
type: NodePort
108108
# if your cluster supports it, uncomment the following to automatically create
109109
# an external load-balanced IP for the frontend service.
110110
# type: LoadBalancer

guestbook/all-in-one/redis-slave.yaml renamed to guestbook/all-in-one/redis-replica.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4-
name: redis-slave
4+
name: redis-replica
55
labels:
66
app: redis
7-
role: slave
7+
role: replica
88
tier: backend
99
spec:
1010
ports:
1111
- port: 6379
1212
selector:
1313
app: redis
14-
role: slave
14+
role: replica
1515
tier: backend
1616
---
1717
apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
1818
kind: Deployment
1919
metadata:
20-
name: redis-slave
20+
name: redis-replica
2121
spec:
2222
selector:
2323
matchLabels:
2424
app: redis
25-
role: slave
25+
role: replica
2626
tier: backend
2727
replicas: 2
2828
template:
2929
metadata:
3030
labels:
3131
app: redis
32-
role: slave
32+
role: replica
3333
tier: backend
3434
spec:
3535
containers:
36-
- name: slave
36+
- name: replica
3737
image: gcr.io/google_samples/gb-redisslave:v1
3838
resources:
3939
requests:

guestbook/legacy/redis-slave-controller.yaml renamed to guestbook/legacy/redis-replica-controller.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
apiVersion: v1
22
kind: ReplicationController
33
metadata:
4-
name: redis-slave
4+
name: redis-replica
55
labels:
66
app: redis
7-
role: slave
7+
role: replica
88
tier: backend
99
spec:
1010
replicas: 2
1111
template:
1212
metadata:
1313
labels:
1414
app: redis
15-
role: slave
15+
role: replica
1616
tier: backend
1717
spec:
1818
containers:
19-
- name: slave
19+
- name: replica
2020
image: gcr.io/google_samples/gb-redisslave:v1
2121
resources:
2222
requests:

0 commit comments

Comments
 (0)