Memcached: Add security context for exporter pod/container

This adds the security context to the memcached prometheus
exporter pod, which changes the default user from root to the
nobody user instead

This also adds the container security context to explicitly set
allowPrivilegeEscalation to false

Change-Id: I3401c1a67f17cef49a478be98f9ab42691b84d66
This commit is contained in:
Steve Wilkerson 2019-01-03 15:02:35 -06:00
parent 3819986398
commit 96a3cf2f6e
2 changed files with 6 additions and 0 deletions

View File

@ -40,6 +40,7 @@ spec:
{{ tuple $envAll "prometheus_memcached_exporter" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} {{ tuple $envAll "prometheus_memcached_exporter" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
namespace: {{ .Values.endpoints.prometheus_memcached_exporter.namespace }} namespace: {{ .Values.endpoints.prometheus_memcached_exporter.namespace }}
spec: spec:
{{ dict "envAll" $envAll "application" "memcached_exporter" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
shareProcessNamespace: true shareProcessNamespace: true
serviceAccountName: {{ $rcControllerName | quote }} serviceAccountName: {{ $rcControllerName | quote }}
nodeSelector: nodeSelector:
@ -52,6 +53,8 @@ spec:
image: {{ .Values.images.tags.prometheus_memcached_exporter }} image: {{ .Values.images.tags.prometheus_memcached_exporter }}
imagePullPolicy: {{ .Values.images.pull_policy }} imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.prometheus_memcached_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.prometheus_memcached_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
allowPrivilegeEscalation: false
command: command:
- /tmp/memcached-exporter.sh - /tmp/memcached-exporter.sh
- start - start

View File

@ -144,6 +144,9 @@ manifests:
service_exporter: true service_exporter: true
pod: pod:
user:
memcached_exporter:
uid: 65534
affinity: affinity:
anti: anti:
topologyKey: topologyKey: