hostPath 目录尽然没有共享成功
来源:10-3 HostPath编排讲解

qq_慕函数1536532
2023-11-03
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: test
labels:
app: busybox
spec:
nodeName: node1
containers:
- name: web
image: nginx
ports:
- containerPort: 80
hostPort: 8080
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
volumes:
- name: workdir
hostPath:
type: Directory
path: /workdir
已经创建了 /workdir, 并且包含 index.html
进入容器, 容器里面并没有 index.html 文件
[root@master pod_schedule]# kubectl get pod -n test
NAME READY STATUS RESTARTS AGE
busybox 1/1 Running 0 4m59s
[root@master pod_schedule]# kubectl exec -it busybox -n test /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@busybox:/# cd /usr/share/nginx/html/
root@busybox:/usr/share/nginx/html# ls
root@busybox:/usr/share/nginx/html#
写回答
1回答
-
暮闲
2023-11-04
同学你好,检查一下,你的pod是不是调度到了你创建了workdir的主机呢?
012023-11-04
相似问题