【发布时间】:2018-10-04 16:46:03
【问题描述】:
我正在尝试将 hostPath 配置为 Kubernetes 中的卷。我已经登录到 VM 服务器,我通常从那里使用 kubernetes 命令,例如 kubectl。
下面是 pod yaml:
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: helloworldanilhostpath
spec:
replicas: 1
template:
metadata:
labels:
run: helloworldanilhostpath
spec:
volumes:
- name: task-pv-storage
hostPath:
path: /home/openapianil/samplePV
type: Directory
containers:
- name: helloworldv1
image: ***/helloworldv1:v1
ports:
- containerPort: 9123
volumeMounts:
- name: task-pv-storage
mountPath: /mnt/sample
在 VM 服务器中,我创建了“/home/openapianil/samplePV”文件夹,其中有一个文件。它有一个 sample.txt 文件。
一旦我尝试创建此部署。它不会发生错误 -
警告 FailedMount 28s (x7 over 59s) kubelet, aks-nodepool1-39499429-1 MountVolume.SetUp failed for volume "task-pv-storage" : hostPath type check failed: /home/openapianil/samplePV is not a directory.
谁能帮我理解这里的问题。
【问题讨论】:
标签: kubernetes