【发布时间】:2019-01-08 19:17:54
【问题描述】:
您好,我正在使用最新的 kubernetes 1.13.1 和 docker-ce(Docker 版本 18.06.1-ce,构建 e68fc7a)。
我设置了一个部署文件,该文件从主机(主机路径)挂载文件并将其挂载到容器中(挂载路径)。
错误是,当我尝试将查找从主机挂载到容器时,我收到一条错误消息,指出它不是文件。 (Kubernetes由于某种原因认为该文件是一个目录)
当我尝试使用以下命令运行容器时: Kubectl 创建 -f 它永远停留在 ContainerCreating 阶段。
使用 Kubectl describe pod 对其进行深入研究后,它会说:
有一条错误消息表明该文件未被识别为文件。
这是部署文件:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: notixxxion
name: notification
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: notification
spec:
containers:
- image: docker-registry.xxxxxx.com/xxxxx/nxxxx:laxxt
name: notixxxion
ports:
- containerPort: xxx0
#### host file configuration
volumeMounts:
- mountPath: /opt/notification/dist/hellow.txt
name: test-volume
readOnly: false
volumes:
- name: test-volume
hostPath:
# directory location on host
path: /exec-ui/app-config/hellow.txt
# this field is optional
type: FileOrCreate
#type: File
status: {}
【问题讨论】:
-
在您的问题中很难读懂您正在运行哪些命令以及什么是文件。使用反引号来注释文字命令,并为代码块使用三次反引号。
标签: docker kubernetes