Skip to content

Commit 8edb9dc

Browse files
committedMay 22, 2024
VPA: v1 - first version of vertical pod autoscaler
1 parent acb9ea1 commit 8edb9dc

File tree

6 files changed

+103
-8
lines changed

6 files changed

+103
-8
lines changed
 

‎.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/deployment

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ src/simdjson
3636
/deployment/pcm/smarter-device-manager/
3737
/deployment/pcm/nri/
3838
/deployment/pcm/kind-with-registry.sh
39+
/deployment/pcm/autoscaler

‎deployment/pcm/.helmignore

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
.vscode/
2424
smarter-device-manager/
2525
nri/
26+
autoscaler/

‎deployment/pcm/README.md

+28-8
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ Helm chart instructions
44

55
### Features:
66

7-
- Configurable as non-privileged container (value: `privileged=false`, default) and privileged container,
7+
- Configurable as non-privileged container (value: `privileged`, default: false) and privileged container,
88
- Support for bare-metal and VM host configurations (files: [values-metal.yaml](values-metal.yaml), [values-vm.yaml](values-vm.yaml)),
99
- Ability to deploy multiple releases alongside configured differently to handle different kinds of machines (bare-metal, VM) at the [same time](#heterogeneous-mixed-vmmetal-instances-cluster),
1010
- Linux Watchdog handling (controlled with `PCM_KEEP_NMI_WATCHDOG`, `PCM_NO_AWS_WORKAROUND`, `nmiWatchdogMount` values).
1111
- Deploy to own namespace with "helm install ... **-n pcm --create-namespace**".
12-
- Silent mode (value: `silent=false`, default).
13-
- Backward compatbile with older Linux kernels (<5.8) - (value: cap_perfmon).
12+
- Silent mode (value: `silent`, default: false).
13+
- Backward compatible with older Linux kernels (<5.8) - (value: cap_perfmon, default: false).
14+
- VerticalPodAutoscaler (value: `verticalPodAutoscaler.enabled`, default: false)
1415

1516
Here are available methods in this chart of metrics collection w.r.t interfaces and required access:
1617

@@ -47,13 +48,12 @@ helm install pcm .
4748
helm install pcm . -f values-direct-privileged.yaml
4849
```
4950

50-
#### Node-feature-discovery + Prometheus podMonitor
51+
#### All opt-in features: Node-feature-discovery + Prometheus podMonitor + vertical
5152

5253
```
53-
helm install ... --set nfd=true --set podMonitor=true
54+
helm install ... --set nfd=true --set podMonitor=true --set verticalPodAutoscaler.enabled=true
5455
```
5556

56-
5757
### Requirements
5858

5959
- Full set of metrics (uncore/UPI, RDT, energy) requires bare-metal or .metal cloud instance.
@@ -180,7 +180,27 @@ kubectl get sts prometheus-prometheus-kube-prometheus-prometheus
180180
Note: `podMonitorSelectorNilUsesHelmValues` is disabled (set to false) so Prometheus operator will be able to handle PCM podMonitor deployed without extra `podMonitorLabels` or otherwise pcm need to be deployed like this:
181181
`helm install pcm . --set podMonitor=true --set podMonitorLabels.release=prometheus` (assuming Prometheus operator was deployed as "prometheus")
182182

183-
#### 5) Deploy PCM helm chart
183+
184+
#### 5) (Optionally) Deploy metric-server and vertical-pod-autoscaler
185+
186+
Note this is irrelevant to pcm-sensor-server functionality, but useful to observer pcm pod CPU/memory usage:
187+
188+
a) metric-server
189+
190+
```
191+
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
192+
helm repo update
193+
helm upgrade --install --set args={--kubelet-insecure-tls} metrics-server metrics-server/metrics-server --namespace kube-system
194+
```
195+
196+
b) vertical pod autoscaler
197+
198+
```
199+
git clone https://github.com/kubernetes/autoscaler
200+
./autoscaler/vertical-pod-autoscaler/hack/vpa-up.sh
201+
```
202+
203+
#### 6) Deploy PCM helm chart
184204

185205
```
186206
# a) Deploy to current namespace with defaults
@@ -194,7 +214,7 @@ helm install pcm . --set nfd=true
194214
helm install pcm . --namespace pcm
195215
```
196216

197-
#### 6) Check metrics are exported
217+
#### 7) Check metrics are exported
198218

199219
Run proxy in background:
200220
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1") (.Values.verticalPodAutoscaler.enabled) }}
2+
apiVersion: autoscaling.k8s.io/v1
3+
kind: VerticalPodAutoscaler
4+
metadata:
5+
name: {{ include "pcm.fullname" . }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "pcm.labels" . | nindent 4 }}
9+
spec:
10+
{{- with .Values.verticalPodAutoscaler.recommenders }}
11+
recommenders:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
resourcePolicy:
15+
containerPolicies:
16+
- containerName: pcm
17+
{{- with .Values.verticalPodAutoscaler.controlledResources }}
18+
controlledResources:
19+
{{- toYaml . | nindent 8 }}
20+
{{- end }}
21+
{{- with .Values.verticalPodAutoscaler.controlledValues }}
22+
controlledValues: {{ . }}
23+
{{- end }}
24+
{{- with .Values.verticalPodAutoscaler.maxAllowed }}
25+
maxAllowed:
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
{{- with .Values.verticalPodAutoscaler.minAllowed }}
29+
minAllowed:
30+
{{- toYaml . | nindent 8 }}
31+
{{- end }}
32+
targetRef:
33+
apiVersion: apps/v1
34+
kind: DaemonSet
35+
name: {{ include "pcm.fullname" . }}
36+
{{- with .Values.verticalPodAutoscaler.updatePolicy }}
37+
updatePolicy:
38+
{{- toYaml . | nindent 4 }}
39+
{{- end }}
40+
{{- end }}

‎deployment/pcm/values.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,35 @@ nfdBaremetalAffinity: false
131131
# feature.node.kubernetes.io/cpu-rdt.RDTMON=true
132132
nfdRDTAffinity: false
133133

134+
135+
### -------------- verticalPodAutoscaler ------------------
136+
# Enable vertical pod autoscaler support for pcm-sensor-server
137+
verticalPodAutoscaler:
138+
enabled: false
139+
140+
# Recommender responsible for generating recommendation for the object.
141+
# List should be empty (then the default recommender will generate the recommendation)
142+
# or contain exactly one recommender.
143+
# recommenders:
144+
# - name: custom-recommender-performance
145+
146+
# List of resources that the vertical pod autoscaler can control. Defaults to cpu and memory
147+
controlledResources: []
148+
# Specifies which resource values should be controlled: RequestsOnly or RequestsAndLimits.
149+
# controlledValues: RequestsAndLimits
150+
151+
# Define the max allowed resources for the pod
152+
maxAllowed: {}
153+
# cpu: 200m
154+
# memory: 100Mi
155+
# Define the min allowed resources for the pod
156+
minAllowed: {}
157+
# cpu: 200m
158+
# memory: 100Mi
159+
160+
# updatePolicy:
161+
# Specifies minimal number of replicas which need to be alive for VPA Updater to attempt pod eviction
162+
# minReplicas: 1
163+
# Specifies whether recommended updates are applied when a Pod is started and whether recommended updates
164+
# are applied during the life of a Pod. Possible values are "Off", "Initial", "Recreate", and "Auto".
165+
# updateMode: Auto

0 commit comments

Comments
 (0)
Failed to load comments.