我在 Kubernetes 集群中运行 RabbitMQ。当我输入以下命令来了解卷在我的 Docker 桌面虚拟机中的挂载位置时
kubectl get pv pvc-7c1bf15b-7f84-406e-a8d9-0c5d7442bd71 -o yaml
我收到以下回复
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
docker.io/hostpath: /var/lib/k8s-pvs/persistence-rabbitmq-server-0/pvc-7c1bf15b-7f84-406e-a8d9-0c5d7442bd71
pv.kubernetes.io/provisioned-by: docker.io/hostpath
creationTimestamp: "2022-06-06T14:55:21Z"
finalizers:
- kubernetes.io/pv-protection
name: pvc-7c1bf15b-7f84-406e-a8d9-0c5d7442bd71
resourceVersion: "9194"
uid: bc0229e3-0d94-454c-b4c7-0ac08ce48d7d
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 50Mi
claimRef:
apiVersion: v1
kind: PersistentVolumeClaim
name: persistence-rabbitmq-server-0
namespace: default
resourceVersion: "9184"
uid: 7c1bf15b-7f84-406e-a8d9-0c5d7442bd71
hostPath:
path: /var/lib/k8s-pvs/persistence-rabbitmq-server-0/pvc-7c1bf15b-7f84-406e-a8d9-0c5d7442bd71
type: ""
persistentVolumeReclaimPolicy: Delete
storageClassName: hostpath
volumeMode: Filesystem
status:
phase: Bound
似乎在 docker 桌面虚拟机中,卷正在安装在此路径上
/var/lib/k8s-pvs/persistence-rabbitmq-server-0/pvc-7c1bf15b-7f84-406e-a8d9-0c5d7442bd71
但是当我通过输入以下命令进入docker桌面虚拟机时
wsl --distribution docker-desktop
我无法在 /var/lib 路径中看到 k8s-pvs 文件夹。有人能告诉我为什么我无法在 docker 桌面虚拟机中的 /var/lib 中查看 k8s-pvs 文件夹吗?
答案1
持久卷存储在docker-desktop-data虚拟机中。
在我的 Windows 11 系统上,hostPath:
/var/lib/k8s-pvs/data-pg-dev-postgresql-0
存在于:
\\wsl.localhost\docker-desktop-data\version-pack-data\community\k8s-pvs