Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
255 views
in Technique[技术] by (71.8m points)

kubernetes - How to create pod with default uid:gid and multiple groups access gids( 4 to 5 ) that's needed to access nfs shares.?

I'm trying to containerize a workflow that touches nfs shares. For a successful run it requires user to have default uid:gid and also additional 4 or 5 groupid access. group ids are random and ideally i would like to avoid giving range of gid's in the yaml file. Is there an efficient way to get this done ? Would anyone be able to show any examples in yaml or point me to reference documents please. Thanks

question from:https://stackoverflow.com/questions/65910839/how-to-create-pod-with-default-uidgid-and-multiple-groups-access-gids-4-to-5

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The setting is called supplementalGroups. Take a look at the example:

apiVersion: v1
kind: Pod
...
spec:
  containers:
  - name: ...
    image: ...
    volumeMounts:
    - name: nfs 
      mountPath: /mnt 
  securityContext: 
    supplementalGroups:
    - 5555
    - 6666
    - 12345 
  volumes:
  - name: nfs 
    nfs:
      server: <nfs_server_ip_or_host>
      path: /opt/nfs 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...