-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathNotes-Kubernetes-19Feb
More file actions
131 lines (98 loc) · 2.07 KB
/
Notes-Kubernetes-19Feb
File metadata and controls
131 lines (98 loc) · 2.07 KB
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
ReplicaSet:
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: myrs
spec:
replicas: 3
selector:
matchExpressions:
- {key: type, operator: In, values: [webserver_1, webserver_2]}
template:
metadata:
name: mypod
labels:
type: webserver_2
spec:
containers:
- name: c1
image: nginx
=======================
Deployment:
=======================
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
name: nginxpod
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
==========================
HPA
=======================
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
resources:
limits:
cpu: 10m
===================
HPA YAML
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: nginx-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: nginx
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 5
============
Service for HPA scenario:
=============
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
spec:
type: ClusterIP
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
================
Command to generate the load:
# kubectl run -i --tty load-generator --rm --image=busybox --restart=Never -- /bin/sh -c "while sleep 0.01; do wget -q -O- http://10.8.10.18:80; done"