我有一个需要创造大量就业机会的 Pod。我想共享一个只读文件夹。我该怎么做?
我可以想象的几个想法(我是 Kubernetes 的新手):
kubectl cp将基础 Pod 之间的数据复制到作业中的 Pod。对此更好的解决方案是什么?
您可以使用 aPersistentVolume并将其安装为 pod 内的只读卷PersistentVolumeClaim。要安装只读卷,请设置.spec.containers[*].volumeMounts[*].readOnly为true。
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: myfrontend
image: nginx
volumeMounts:
- mountPath: "/var/www/html"
name: mypd
readOnly: true
volumes:
- name: mypd
persistentVolumeClaim:
claimName: myclaim
Run Code Online (Sandbox Code Playgroud)
查看这些链接:
| 归档时间: |
|
| 查看次数: |
808 次 |
| 最近记录: |