gpt4 book ai didi

amazon-web-services - Kubernetes:如何设置 VolumeMount 用户组和文件权限

转载 作者:IT老高 更新时间:2023-10-28 12:37:48 26 4
gpt4 key购买 nike

我正在使用 kops 在 AWS 上运行 Kubernetes 集群。我已将 EBS 卷安装到容器上,它在我的应用程序中可见,但它是只读的,因为我的应用程序没有以 root 身份运行。如何以 root 以外的用户身份挂载 PersistentVolumeClaimVolumeMount 似乎没有任何选项来控制挂载路径的用户、组或文件权限。

这是我的部署 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 用户组和文件权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43544370/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com