Azure 上的 Kubernetes
Kubernetes on azure
我在 Azure 上使用 Kubernetes,我的架构作为图像附加。
我可以使用 azure 文件创建持久卷,并使用持久卷声明将其附加到我的 pods。
我的问题是:
正如你在图片上看到的,天蓝色文件上有文件和目录,我需要对这些设置特殊权限 files/directories
例如
- notes.txt 与 ( rw--)
- user1 成为目录数据的所有者
- user2 成为工具的所有者
- 工具格式有权限
(rwx-rw-r) 和统计 (rwx-r-r)
我问过这个功能,它没有在 azure 文件上实现。你能建议任何其他解决方案吗?
提前致谢。
此致,
哈吉姆
您可以使用 kubernetes 安全上下文来配置对您的坐骑的访问。检查这个 link https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
引用文档:
由于指定了 fsGroup 字段,容器的所有进程也是补充组 ID 2000 的一部分。卷 /data/demo 的所有者以及在该卷中创建的任何文件都将是组编号 2000.
apiVersion: v1
kind: Pod
metadata:
name: security-context-demo
spec:
securityContext:
runAsUser: 1000
runAsGroup: 3000
fsGroup: 2000
volumes:
- name: sec-ctx-vol
emptyDir: {}
containers:
- name: sec-ctx-demo
image: busybox
command: [ "sh", "-c", "sleep 1h" ]
volumeMounts:
- name: sec-ctx-vol
mountPath: /data/demo
securityContext:
allowPrivilegeEscalation: false
我在 Azure 上使用 Kubernetes,我的架构作为图像附加。
我可以使用 azure 文件创建持久卷,并使用持久卷声明将其附加到我的 pods。
我的问题是:
正如你在图片上看到的,天蓝色文件上有文件和目录,我需要对这些设置特殊权限 files/directories
例如
- notes.txt 与 ( rw--)
- user1 成为目录数据的所有者
- user2 成为工具的所有者
- 工具格式有权限 (rwx-rw-r) 和统计 (rwx-r-r)
我问过这个功能,它没有在 azure 文件上实现。你能建议任何其他解决方案吗?
提前致谢。
此致,
哈吉姆
您可以使用 kubernetes 安全上下文来配置对您的坐骑的访问。检查这个 link https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
引用文档:
由于指定了 fsGroup 字段,容器的所有进程也是补充组 ID 2000 的一部分。卷 /data/demo 的所有者以及在该卷中创建的任何文件都将是组编号 2000.
apiVersion: v1
kind: Pod
metadata:
name: security-context-demo
spec:
securityContext:
runAsUser: 1000
runAsGroup: 3000
fsGroup: 2000
volumes:
- name: sec-ctx-vol
emptyDir: {}
containers:
- name: sec-ctx-demo
image: busybox
command: [ "sh", "-c", "sleep 1h" ]
volumeMounts:
- name: sec-ctx-vol
mountPath: /data/demo
securityContext:
allowPrivilegeEscalation: false