-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.webapp-replicaset.yaml
76 lines (76 loc) · 2.18 KB
/
2.webapp-replicaset.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
# Replicaset definition for the webapp deployed in 1.webapp-pod.yaml
# Replicasets ensure the number of pods are always alive
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: webapp
namespace: demo
labels:
app: demo
tier: frontend
spec:
replicas: 3 # Number of replicas we would need to be always available.
selector: # Below configuration identifies and controls the pods to be created
matchLabels:
tier: frontend
template: # Pod definition template
metadata: # The labels for the pods to be created, this should contain all the "selector.matchLabels" labels and can have more
labels:
tier: frontend
spec: # Same definition as 1.webapp-pod.yaml
containers:
- name: webapp
image: pratapgowda/demo-webapp:1.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
volumeMounts:
- name: workdir
mountPath: /usr/share/webapp/html
resources:
limits:
cpu: "500m"
memory: 1G
requests:
cpu: "25m"
memory: 100Mi
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 3
periodSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 3
periodSeconds: 3
- name: sidecar
image: busybox
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: "500m"
memory: 1G
requests:
cpu: "25m"
memory: 100Mi
command:
- sleep
- "6000"
# These containers are run during pod initialization
initContainers:
- name: initializer
image: pratapgowda/demo-initializer
imagePullPolicy: IfNotPresent
env:
- name: WAIT_IN_SECS
value: "1"
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir: {}