prometheus-kube-state-metrics: Add container security context

This adds the container security context to set
readOnlyRootFilesystem to true

Change-Id: I1cc81e2284dbbe94739fd498ccfd3e0ee96dfdbd
This commit is contained in:
Rahul Khiyani 2019-03-18 16:09:59 -04:00
parent 2b1e7ebc21
commit edb24bd537
2 changed files with 8 additions and 6 deletions

View File

@ -111,8 +111,6 @@ spec:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
spec:
securityContext:
readOnlyRootFilesystem: true
{{ dict "envAll" $envAll "application" "kube_state_metrics" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }}
nodeSelector:
@ -124,8 +122,7 @@ spec:
- name: kube-state-metrics
{{ tuple $envAll "kube_state_metrics" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.kube_state_metrics | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
allowPrivilegeEscalation: false
{{ dict "envAll" $envAll "application" "kube_state_metrics" "container" "kube_state_metrics" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- /tmp/kube-state-metrics.sh
ports:

View File

@ -37,9 +37,14 @@ labels:
node_selector_value: enabled
pod:
user:
security_context:
kube_state_metrics:
uid: 65534
pod:
runAsUser: 65534
container:
kube_state_metrics:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
affinity:
anti:
type: