-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3.webapp-deployment.yaml
82 lines (82 loc) · 2.36 KB
/
3.webapp-deployment.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
# Deployment to control creation of pods and update the containers
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp
namespace: demo
labels:
app: demo
tier: frontend
spec:
revisionHistoryLimit: 3 # Limit of history maintained by deployment, useful for rollback
replicas: 3 # Minimum number of replicase gauranteed
strategy: # Upgrade strategy
type: RollingUpdate # Can be either a "RollingUpdate" Or "Recreate"
rollingUpdate:
maxUnavailable: 1 # Maximum number of old pods that are unavailable during upgrade, can be a percent too
maxSurge : 1 # The maximum number of pods that can be scheduled above the desired number of pods
# Below definition is simliar to a replicaset deployed in 2.webapp-replicaset.yaml
selector:
matchLabels:
tier: frontend
template:
metadata:
labels:
tier: frontend
spec:
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: {}