-
Notifications
You must be signed in to change notification settings - Fork 0
/
hpa-example.yaml
61 lines (61 loc) · 1011 Bytes
/
hpa-example.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
apiVersion: v1
kind: Namespace
metadata:
name: mc-ns
---
apiVersion: v1
kind: Service
metadata:
namespace: mc-ns
name: mc-lb
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: mc-stress
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: mc-ns
labels:
app: mc-stress
name: mc-web
spec:
selector:
matchLabels:
app: mc-stress
replicas: 1
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app: mc-stress
spec:
containers:
- image: k8s.gcr.io/hpa-example
name: stresser
ports:
- containerPort: 80
resources:
requests:
cpu: 0.2
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: mc-hpa
namespace: mc-ns
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mc-web
minReplicas: 1
maxReplicas: 50
targetCPUUtilizationPercentage: 50