Configure user ID for logger container's securityContext using helm values.yaml (#3005)

* Run logger as root to allow access to log files from host

* Add to connect part of yaml

* Change fission folder to allow non-root to write
into folder instead

* Configure user ID for logger from helm values.yaml

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
Co-authored-by: Mark Retallack <mark.retallack@yunextraffic.com>
This commit is contained in:
soharab-ic
2024-09-02 11:06:55 +05:30
committed by GitHub
co-authored by Mark Retallack
parent 11baffc92c
commit b80437b78c
2 changed files with 14 additions and 5 deletions
@@ -128,10 +128,8 @@ spec:
- name: docker-log
mountPath: /var/lib/docker/containers
readOnly: true
{{- if .Values.logger.enableSecurityContext }}
securityContext:
privileged: true
{{- end }}
{{- toYaml .Values.logger.securityContext | nindent 12 }}
- name: fluentbit
{{- if .Values.repository }}
image: "{{ .Values.logger.fluentdImageRepository }}/{{ .Values.logger.fluentdImage }}:{{ .Values.logger.fluentdImageTag }}"
+13 -2
View File
@@ -620,11 +620,22 @@ logger:
## Fluent-bit writes/reads its own sqlite database to record a history of tracked
## files and a state of offsets, this is very useful to resume a state if the ser-
## vice is restarted. For Kubernetes environment with constraints like OpenShift,
## vice is restarted.
##
## For Kubernetes environment with constraints like OpenShift,
## the containers are limited to write hostPath volume. Hence, we have to enable
## security context and set privileged to true.
##
enableSecurityContext: false
## The user ID in runAsUser should have access to the `/var/log` and
## `/var/lib/docker/containers` directories on your host.
## On many hosts, this user might be root ,i.e., `runAsUser: 0`.
## Although it is recommended not to use root user for security reasons.
##
## The `/var/log` and `/var/lib/docker/containers` directories on host are mounted
## to logger container with volumeType `HostPath`.
securityContext: {}
# privileged: true
# runAsUser: 0
## Enable PodSecurityPolicies to allow privileged container
## Only required in some clusters and when enableSecurityContext is true