+-
amazon-web-services – Kubernetes:如何设置VolumeMount用户组和文件权限
我正在使用kops在AWS上运行Kubernetes集群.我已经将一个EBS卷安装到一个容器上,它可以从我的应用程序中看到,但它是只读的,因为我的应用程序不是以root身份运行的.如何以非root用户身份挂载PersistentVolumeClaim? VolumeMount似乎没有任何选项来控制已安装路径的用户,组或文件权限.

这是我的部署yaml文件:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: notebook-1
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: notebook-1
    spec:
      volumes:
      - name: notebook-1
        persistentVolumeClaim:
          claimName: notebook-1
      containers:
      - name: notebook-1
        image: jupyter/base-notebook
        ports:
        - containerPort: 8888
        volumeMounts:
        - mountPath: "/home/jovyan/work"
          name: notebook-1
最佳答案
Pod安全上下文支持设置fsGroup,它允许您设置拥有卷的组ID,从而可以写入谁.文档中的示例:

apiVersion: v1
kind: Pod
metadata:
  name: hello-world
spec:
  containers:
  # specification of the pod's containers
  # ...
  securityContext:
    fsGroup: 1234

关于这个的更多信息是here

点击查看更多相关文章

转载注明原文:amazon-web-services – Kubernetes:如何设置VolumeMount用户组和文件权限 - 乐贴网