diff --git a/charts/flagger/templates/prometheus.yaml b/charts/flagger/templates/prometheus.yaml index beff9a53..e029b624 100644 --- a/charts/flagger/templates/prometheus.yaml +++ b/charts/flagger/templates/prometheus.yaml @@ -255,6 +255,10 @@ spec: mountPath: /etc/prometheus - name: data-volume mountPath: /prometheus/data + {{- if .Values.prometheus.securityContext.enabled }} + securityContext: +{{ toYaml .Values.prometheus.securityContext.context | indent 12 }} + {{- end }} {{- if .Values.prometheus.pullSecret }} imagePullSecrets: - name: {{ .Values.prometheus.pullSecret }} diff --git a/charts/flagger/values.yaml b/charts/flagger/values.yaml index c4d5ec26..39cee38d 100644 --- a/charts/flagger/values.yaml +++ b/charts/flagger/values.yaml @@ -127,6 +127,12 @@ prometheus: image: docker.io/prom/prometheus:v2.23.0 pullSecret: retention: 2h + # when enabled, it will add a security context for the prometheus pod + securityContext: + enabled: false + context: + readOnlyRootFilesystem: true + runAsUser: 10001 kubeconfigQPS: "" kubeconfigBurst: ""