'Secret mount on Kubernetes container fails with security context (run as non-root user) added
I share a part of the manifest where I added security context added. If I remove the security context, it works fine. I try to use non-root user to up the container. Not sure, what I did wrong below
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
runAsUser: 2000
allowPrivilegeEscalation: false
ports:
- name: http
containerPort: 8010
protocol: TCP
volumeMounts:
- name: mount-jmx-secret
mountPath: "etc/hello-world"
volumes:
- name: mount-jmx-secret
secret:
secretName: jmxsecret
defaultMode: 0600
Solution 1:[1]
I do not know what mistake I made. It worked fine after couple of reinstalls of helm charts. Changes I made, Added a new user to docker file
RUN useradd -u 8877 <user_name>(ram)
USER ram
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ratna |
