Skip to content

Commit 4d12a8b

Browse files
committed
Convert guestbook-go json to yaml
The first step in bringing this up to a more up-to-date example.
1 parent 8c357b6 commit 4d12a8b

13 files changed

+124
-199
lines changed

guestbook-go/README.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ 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.json` 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 [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).
2828

29-
1. Use the [redis-master-controller.json](redis-master-controller.json) 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 replication controller in your Kubernetes cluster by running the `kubectl create -f` *`filename`* command:
3030

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

@@ -73,10 +73,10 @@ A Kubernetes [service](https://kubernetes.io/docs/concepts/services-networking/s
7373

7474
Services find the pods to load balance based on pod labels. The pod that you created in Step One has the label `app=redis` and `role=master`. The selector field of the service determines which pods will receive the traffic sent to the service.
7575

76-
1. Use the [redis-master-service.json](redis-master-service.json) file to create the service in your Kubernetes cluster by running the `kubectl create -f` *`filename`* command:
76+
1. Use the [redis-master-service.yaml](redis-master-service.yaml) file to create the service in your Kubernetes cluster by running the `kubectl create -f` *`filename`* command:
7777

7878
```console
79-
$ kubectl create -f examples/guestbook-go/redis-master-service.json
79+
$ kubectl create -f examples/guestbook-go/redis-master-service.yaml
8080
8181
```
8282

@@ -96,10 +96,10 @@ Services find the pods to load balance based on pod labels. The pod that you cre
9696

9797
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-replica-controller.json](redis-replica-controller.json) 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 replication controller by running the `kubectl create -f` *`filename`* command:
100100

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

@@ -139,10 +139,10 @@ The Redis master we created earlier is a single pod (REPLICAS = 1), while the Re
139139

140140
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-replica-service.json](redis-replica-service.json) file to create the Redis replica service by running the `kubectl create -f` *`filename`* command:
142+
1. Use the [redis-replica-service.yaml](redis-replica-service.yaml) 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-replica-service.json
145+
$ kubectl create -f examples/guestbook-go/redis-replica-service.yaml
146146
147147
```
148148

@@ -164,14 +164,14 @@ Tip: It is helpful to set labels on your services themselves--as we've done here
164164

165165
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

167-
1. Use the [guestbook-controller.json](guestbook-controller.json) 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 replication controller by running the `kubectl create -f` *`filename`* command:
168168

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

174-
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.json.
174+
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

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

@@ -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.json](guestbook-service.json) 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 create -f` *`filename`* command:
208208

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

213213

guestbook-go/guestbook-controller.json

-37
This file was deleted.
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
kind: ReplicationController
2+
apiVersion: v1
3+
metadata:
4+
name: guestbook
5+
labels:
6+
app: guestbook
7+
spec:
8+
replicas: 3
9+
selector:
10+
app: guestbook
11+
template:
12+
metadata:
13+
labels:
14+
app: guestbook
15+
spec:
16+
containers:
17+
- name: guestbook
18+
image: k8s.gcr.io/guestbook:v3
19+
ports:
20+
- name: http-server
21+
containerPort: 3000

guestbook-go/guestbook-service.json

-22
This file was deleted.

guestbook-go/guestbook-service.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: guestbook
5+
labels:
6+
app: guestbook
7+
spec:
8+
ports:
9+
- port: 3000
10+
targetPort: http-server
11+
selector:
12+
app: guestbook
13+
type: LoadBalancer

guestbook-go/redis-master-controller.json

-40
This file was deleted.
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
kind: ReplicationController
2+
apiVersion: v1
3+
metadata:
4+
name: redis-master
5+
labels:
6+
app: redis
7+
role: master
8+
spec:
9+
replicas: 1
10+
selector:
11+
app: redis
12+
role: master
13+
template:
14+
metadata:
15+
labels:
16+
app: redis
17+
role: master
18+
spec:
19+
containers:
20+
- name: redis-master
21+
image: k8s.gcr.io/redis:e2e
22+
ports:
23+
- name: redis-server
24+
containerPort: 6379

guestbook-go/redis-master-service.json

-23
This file was deleted.
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: redis-master
5+
labels:
6+
app: redis
7+
role: master
8+
spec:
9+
ports:
10+
- port: 6379
11+
targetPort: redis-server
12+
selector:
13+
app: redis
14+
role: master

guestbook-go/redis-replica-controller.json

-40
This file was deleted.
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
kind: ReplicationController
2+
apiVersion: v1
3+
metadata:
4+
name: redis-replica
5+
labels:
6+
app: redis
7+
role: replica
8+
spec:
9+
replicas: 2
10+
selector:
11+
app: redis
12+
role: replica
13+
template:
14+
metadata:
15+
labels:
16+
app: redis
17+
role: replica
18+
spec:
19+
containers:
20+
- name: redis-replica
21+
image: k8s.gcr.io/redis-slave:v2
22+
ports:
23+
- name: redis-server
24+
containerPort: 6379

guestbook-go/redis-replica-service.json

-23
This file was deleted.
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: redis-replica
5+
labels:
6+
app: redis
7+
role: replica
8+
spec:
9+
ports:
10+
- port: 6379
11+
targetPort: redis-server
12+
selector:
13+
app: redis
14+
role: replica

0 commit comments

Comments
 (0)