-
Notifications
You must be signed in to change notification settings - Fork 1
/
5. Deploy Guest Book App on Kubernetes.yaml
182 lines (140 loc) · 3.99 KB
/
5. Deploy Guest Book App on Kubernetes.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# The Nautilus Application development team has finished development of one of the applications and it is ready for deployment. It is a guestbook application that will be used to manage entries for guests/visitors. As per discussion with the DevOps team, they have finalized the infrastructure that will be deployed on Kubernetes cluster. Below you can find more details about it.
# BACK-END TIER
# Create a deployment named redis-master for Redis master.
# a.) Replicas count should be 1.
# b.) Container name should be master-redis-devops and it should use image redis.
# c.) Request resources as CPU should be 100m and Memory should be 100Mi.
# d.) Container port should be redis default port i.e 6379.
# Create a service named redis-master for Redis master. Port and targetPort should be Redis default port i.e 6379.
# Create another deployment named redis-slave for Redis slave.
# a.) Replicas count should be 2.
# b.) Container name should be slave-redis-devops and it should use gcr.io/google_samples/gb-redisslave:v3 image.
# c.) Requests resources as CPU should be 100m and Memory should be 100Mi.
# d.) Define an environment variable named GET_HOSTS_FROM and its value should be dns.
# e.) Container port should be Redis default port i.e 6379.
# Create another service named redis-slave. It should use Redis default port i.e 6379.
# FRONT END TIER
# Create a deployment named frontend.
# a.) Replicas count should be 3.
# b.) Container name should be php-redis-devops and it should use gcr.io/google-samples/gb-frontend:v4 image.
# c.) Request resources as CPU should be 100m and Memory should be 100Mi.
# d.) Define an environment variable named as GET_HOSTS_FROM and its value should be dns.
# e.) Container port should be 80.
# Create a service named frontend. Its type should be NodePort, port should be 80 and its nodePort should be 30009.
# Finally, you can check the guestbook app by clicking on App button.
# You can use any labels as per your choice.
# Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.
# CheckCompleteIncompleteTry Later
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
spec:
replicas: 1
selector:
matchLabels:
app: redis-master
template:
metadata:
labels:
app: redis-master
spec:
containers:
- name: master-redis-datacenter
image: redis
resources:
requests:
memory: "100Mi"
cpu: "100m"
ports:
- containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
name: redis-master
spec:
selector:
app: redis-master
ports:
- port: 6379
targetPort: 6379
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
spec:
replicas: 2
selector:
matchLabels:
app: redis-slave
template:
metadata:
labels:
app: redis-slave
spec:
containers:
- name: slave-redis-datacenter
image: gcr.io/google_samples/gb-redisslave:v3
resources:
requests:
memory: "100Mi"
cpu: "100m"
env:
- name: GET_HOSTS_FROM
value: dns
ports:
- containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
name: redis-slave
spec:
selector:
app: redis-slave
ports:
- port: 6379
targetPort: 6379
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: php-redis-datacenter
image: gcr.io/google-samples/gb-frontend:v4
resources:
requests:
memory: "100Mi"
cpu: "100m"
env:
- name: GET_HOSTS_FROM
value: dns
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: frontend
spec:
type: NodePort
selector:
app: frontend
ports:
- port: 80
targetPort: 80
nodePort: 30009