【发布时间】:2018-11-21 05:58:39
【问题描述】:
我无法使用多文件夹卷挂载来挂载配置映射。
我的volume-mount.yaml的结构如下:
不起作用
apiVersion: v1
kind: Pod
metadata:
name: test-web
spec:
containers:
- name: test-web
image: docker.io/hello-world
volumeMounts:
- name: config-volume
mountPath: /usr/test
volumes:
- name: config-volume
configMap:
name: test-config-map
items:
- key: application.properties
path: test-web
- key: test.xml
path: test-web/configs/test_config
restartPolicy: Never
错误:
MountVolume.SetUp failed for volume "config-volume" : open /var/lib/kubelet/pods/93768c34-6dc6-11e8-9546-025000000001/volumes/kubernetes.io~configmap/config-volume/..2018_06_11_22_27_08.476420050/test-web: is a directory`
有效
apiVersion: v1
kind: Pod
metadata:
name: test-web
spec:
containers:
- name: test-web
image: docker.io/hello-world
volumeMounts:
- name: config-volume
mountPath: /usr/test
volumes:
- name: config-volume
configMap:
name: test-config-map
items:
- key: test.xml
path: test-web/configs/test_config
restartPolicy: Never
此外,configmap 正在以 root 用户身份挂载,因为我们希望卷挂载以特定用户身份进行。
请告诉我我的 yaml 文件中可能缺少什么来解决上述 2 个问题。
【问题讨论】:
-
能否请您列出您的配置图(或最小示例)?
标签: docker kubernetes mount