0

We are mounting all the volumes as a non-root user inside the container in a pod using the securityContext. However, for all the configmaps and secrets the volumemount user is still root. I tried the initContainer approach without any success.

I searched on net and didn't get any information on changing the user for the volumemounts for configmaps/secrets as a non-root user. Can anyone please help me here?

Nishant Kansal
  • 501
  • 1
  • 10
  • 23

1 Answers1

1

Did you create the user in the docker file and uses the below configuration in Kubernetes?

Dockerfile

RUN useradd nonroot -u 10001
USER 10001

Kubernetes:

securityContext:
  runAsNonRoot: true
  runAsUser: 10001
karthik
  • 193
  • 1
  • 1
  • 13