Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit a9fd5da

Browse files
madalazaruniemimu
authored andcommitted
Tighten custom-metrics-apiserver container security
This commit will: - run container as non-root - drop all capabiltiies and mark the fs ar read-only - add CPU,memory resource & limits Signed-off-by: Madalina Lazar <[email protected]>
1 parent c0dc087 commit a9fd5da

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

telemetry-aware-scheduling/deploy/charts/prometheus_custom_metrics_helm_chart/templates/custom-metrics-apiserver-deployment.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
serviceAccountName: custom-metrics-apiserver
2020
containers:
2121
- name: custom-metrics-apiserver
22-
image: directxman12/k8s-prometheus-adapter-amd64
22+
image: directxman12/k8s-prometheus-adapter-amd64:v0.8.4
2323
args:
2424
- --secure-port=6443
2525
- --tls-cert-file=/var/run/serving-cert/tls.crt
@@ -29,6 +29,16 @@ spec:
2929
- --metrics-relist-interval=1m
3030
- --v=10
3131
- --config=/etc/adapter/config.yaml
32+
securityContext:
33+
capabilities:
34+
drop: [ 'ALL' ]
35+
allowPrivilegeEscalation: false
36+
readOnlyRootFilesystem: true
37+
runAsNonRoot: true
38+
runAsUser: 10001
39+
runAsGroup: 10001
40+
seccompProfile:
41+
type: RuntimeDefault
3242
ports:
3343
- containerPort: 6443
3444
volumeMounts:
@@ -40,6 +50,13 @@ spec:
4050
readOnly: true
4151
- mountPath: /tmp
4252
name: tmp-vol
53+
resources:
54+
limits:
55+
memory: "500Mi"
56+
cpu: "500m"
57+
requests:
58+
memory: "150Mi"
59+
cpu: "300m"
4360
volumes:
4461
- name: volume-serving-cert
4562
secret:

0 commit comments

Comments
 (0)