File tree Expand file tree Collapse file tree 5 files changed +63
-46
lines changed
optional-container-engine Expand file tree Collapse file tree 5 files changed +63
-46
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ all: deploy
66.PHONY : create-cluster
77create-cluster :
88 gcloud container clusters create bookshelf \
9- --scope " https://www.googleapis.com/auth/userinfo.email" ," cloud-platform"
9+ --scope " cloud-platform" \
10+ --num-nodes 2
1011 gcloud container clusters get-credentials bookshelf
1112
1213.PHONY : create-bucket
@@ -27,6 +28,10 @@ template:
2728 sed -i " .tmpl" " s/\$ $GCLOUD_PROJECT /$( GCLOUD_PROJECT) /g" bookshelf-frontend.yaml
2829 sed -i " .tmpl" " s/\$ $GCLOUD_PROJECT /$( GCLOUD_PROJECT) /g" bookshelf-worker.yaml
2930
31+ .PHONY : create-service
32+ create-service :
33+ kubectl create -f bookshelf-service.yaml
34+
3035.PHONY : deploy-frontend
3136deploy-frontend : push template
3237 kubectl create -f bookshelf-frontend.yaml
@@ -36,10 +41,10 @@ deploy-worker: push template
3641 kubectl create -f bookshelf-worker.yaml
3742
3843.PHONY : deploy
39- deploy : deploy-frontend deploy-worker
44+ deploy : deploy-frontend deploy-worker create-service
4045
4146.PHONY : delete
4247delete :
43- kubectl delete rc bookshelf-frontend
44- kubectl delete rc bookshelf-worker
45- kubectl delete service bookshelf-frontend
48+ - kubectl delete -f bookshelf-frontend.yaml
49+ - kubectl delete -f bookshelf-worker.yaml
50+ - kubectl delete -f bookshelf-frontend.yaml
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ This optional tutorial will walk you through how to deploy the Bookshelf sample
2222Create a cluster for the bookshelf application:
2323
2424 gcloud container clusters create bookshelf \
25- --scope "https://www.googleapis.com/auth/userinfo.email"," cloud-platform" \
25+ --scope "cloud-platform" \
2626 --num-nodes 2
2727 gcloud container clusters get-credentials bookshelf
2828
Original file line number Diff line number Diff line change 1515# This file configures the bookshelf application frontend. The frontend serves
1616# public web traffic.
1717
18- # The bookshelf frontend replication controller ensures that at least 3
18+ apiVersion : extensions/v1beta1
19+ kind : Deployment
20+ metadata :
21+ name : bookshelf-frontend
22+ labels :
23+ app : bookshelf
24+ # The bookshelf frontend replica set ensures that at least 3
1925# instances of the bookshelf app are running on the cluster.
2026# For more info about Pods see:
2127# https://cloud.google.com/container-engine/docs/pods/
22- # For more info about Replication Controllers:
23- # https://cloud.google.com/container-engine/docs/replicationcontrollers/
24- apiVersion : v1
25- kind : ReplicationController
26- metadata :
27- name : bookshelf-frontend
2828spec :
2929 replicas : 3
3030 template :
4949 value : bookshelf
5050 # The bookshelf process listens on port 8080 for web traffic by default.
5151 ports :
52- - containerPort : 8080
53-
54- ---
55-
56- # The bookshelf service provides a load-balancing proxy over the bookshelf app
57- # pods. By specifying the type as a 'LoadBalancer', Container Engine will
58- # create an external HTTP load balancer.
59- # For more information about Services see:
60- # https://cloud.google.com/container-engine/docs/services/
61- # For more information about external HTTP load balancing see:
62- # https://cloud.google.com/container-engine/docs/load-balancer
63- apiVersion : v1
64- kind : Service
65- metadata :
66- name : bookshelf-frontend
67- labels :
68- app : bookshelf
69- tier : frontend
70- spec :
71- type : LoadBalancer
72- ports :
73- - port : 80
74- targetPort : 8080
75- selector :
76- app : bookshelf
77- tier : frontend
52+ - name : http-server
53+ containerPort : 8080
Original file line number Diff line number Diff line change 1+ # Copyright 2016 Google Inc.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License
14+
15+ # The bookshelf service provides a load-balancing proxy over the bookshelf
16+ # frontend pods. By specifying the type as a 'LoadBalancer', Container Engine
17+ # will create an external HTTP load balancer.
18+ # For more information about Services see:
19+ # https://cloud.google.com/container-engine/docs/services/
20+ # For more information about external HTTP load balancing see:
21+ # https://cloud.google.com/container-engine/docs/load-balancer
22+ apiVersion : v1
23+ kind : Service
24+ metadata :
25+ name : bookshelf-frontend
26+ labels :
27+ app : bookshelf
28+ tier : frontend
29+ spec :
30+ type : LoadBalancer
31+ ports :
32+ - port : 80
33+ targetPort : http-server
34+ selector :
35+ app : bookshelf
36+ tier : frontend
Original file line number Diff line number Diff line change 1515# This file configures the bookshelf task worker. The worker is responsible
1616# for processing book requests and updating book information.
1717
18- # The bookshelf worker controller ensures that at least 3 instances of the
18+ apiVersion : extensions/v1beta1
19+ kind : Deployment
20+ metadata :
21+ name : bookshelf-worker
22+ labels :
23+ app : bookshelf
24+ # The bookshelf worker replica set ensures that at least 2 instances of the
1925# bookshelf worker pod are running on the cluster.
2026# For more info about Pods see:
2127# https://cloud.google.com/container-engine/docs/pods/
22- # For more info about Replication Controllers:
23- # https://cloud.google.com/container-engine/docs/replicationcontrollers/
24- apiVersion : v1
25- kind : ReplicationController
26- metadata :
27- name : bookshelf-worker
2828spec :
2929 replicas : 2
3030 template :
You can’t perform that action at this time.
0 commit comments