File tree 1 file changed +37
-10
lines changed
1 file changed +37
-10
lines changed Original file line number Diff line number Diff line change 50
50
51
51
---
52
52
53
- ## Horizontal pod autoscaler (HPA)
54
-
55
53
``` yaml
56
54
apiVersion : autoscaling/v1
57
55
kind : HorizontalPodAutoscaler
@@ -64,23 +62,52 @@ spec:
64
62
name : my-app
65
63
minReplicas : 1
66
64
maxReplicas : 10
67
- targetCPUUtilizationPercentage : 50
65
+ metrics :
66
+ - type : Resource
67
+ resource :
68
+ name : cpu
69
+ target :
70
+ type : Utilization
71
+ averageUtilization : 50
68
72
` ` `
69
- <!-- .element: style="float: right; width: 22em ;" -->
73
+ <!-- .element: style="float: right; width: 18em; margin-top: 1em; margin-left: 1em ;" -->
70
74
71
- Change replicas based on CPU consumption
75
+ ## Horizontal pod<br/>autoscaler (HPA) 1/
72
76
73
- XXX
77
+ Manually scaling pods is time consuming
78
+
79
+ HPA [](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) changes replicas automagically
80
+
81
+ Supports CPU and memory usage
74
82
75
83
### Demo
76
84
77
- XXX deploy nginx
85
+ Deploy nginx and HPA
86
+
87
+ Create load and watch hpa scale nginx
88
+
89
+ ---
78
90
79
- XXX add hpa
91
+ ## Horizontal pod autoscaler (HPA) 2/2
92
+
93
+ ### Internals
94
+
95
+ Prerequisites: metrics-server []()
96
+
97
+ Checks every 15 seconds
98
+
99
+ Calculates the required number of replicas:
100
+
101
+ ` ` ` plaintext
102
+ desiredReplicas
103
+ = ceil[currentReplicas * (currentMetricValue / desiredMetricValue)]
104
+ ```
105
+ <!-- .element: style="font-size: smaller; width: 40em;" -->
80
106
81
- XXX create load
107
+ Configurable behaviour:
82
108
83
- XXX watch hpa scale nginx
109
+ - Scaling policies [ ] ( https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior )
110
+ - Stabilization window [ ] ( https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#stabilization-window )
84
111
85
112
---
86
113
You can’t perform that action at this time.
0 commit comments