Skip to content

fsGroup does not change the owner of the mounted directory. #9885

Answered by LennyLip
LennyLip asked this question in Q&A
Discussion options

You must be logged in to vote

Resolved by this code, but I don't understand why is fsGroup is not works directly.

      initContainers:
        - name: set-volume-ownership
          image: busybox:1.28
          command: ["sh", "-c", "chown -R 2000:2000 /data/demo"]
          volumeMounts:
            - name: sec-ctx-vol
              mountPath: /data/demo
          securityContext:
            runAsUser: 0 # <-run as root
            runAsGroup: 0

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by LennyLip
Comment options

You must be logged in to vote
2 replies
@LennyLip
Comment options

@smira
Comment options

smira Dec 6, 2024
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants