-
Notifications
You must be signed in to change notification settings - Fork 3
/
3-backend.yaml
90 lines (84 loc) · 1.91 KB
/
3-backend.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
apiVersion: v1
kind: ConfigMap
metadata:
name: demo-backend-cm
namespace: kubernetes-demo
data:
MONGODB_URI: "mongodb://mongodb-0.mongodb.kubernetes-demo.svc.cluster.local:27017/sample-app"
JAVA_OPTS: "-Dspring.profiles.active=local-docker -Xms125m -Xmx250m"
---
apiVersion: v1
kind: Service
metadata:
name: demo-backend-deployment-service
namespace: kubernetes-demo
labels:
app: demo-backend-deployment
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: demo-backend-deployment
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-backend-deployment
labels:
app: demo-backend-deployment
namespace: kubernetes-demo
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: demo-backend-deployment
template:
metadata:
labels:
app: demo-backend-deployment
spec:
containers:
- image: cunal/demo-backend:51e393ef4be964e1c0a11cbc869d397a82700190
imagePullPolicy: IfNotPresent
readinessProbe:
httpGet:
path: /actuator/health
port: 80
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 3
resources:
requests:
cpu: "800m"
limits:
cpu: "1000m"
name: demo-backend-deployment
ports:
- containerPort: 80
envFrom:
- configMapRef:
name: demo-backend-cm
---
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: demo-backend-hpa
namespace: kubernetes-demo
spec:
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: demo-backend-deployment
minReplicas: 3
maxReplicas: 7
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 10