如果一个 Ceph 集群上存在多个 CephFS,那么在 Kubernetes 中使用 CephFS Volume 时,可以通过在 volume 的配置中指定 path 参数来指定要挂载的具体文件系统路径。
例如,假设 Ceph 集群上存在两个 CephFS 文件系统:/my-fs1 和 /my-fs2,则可以按照以下方式配置 Kubernetes 中的 Volume:
apiVersion: v1
kind: Pod
metadata:
name: cephfs-pod
spec:
containers:
- name: cephfs-container
image: busybox
command: ["/bin/sh", "-c", "sleep 3600"]
volumeMounts:
- name: cephfs-vol
mountPath: /mnt/cephfs
volumes:
- name: cephfs-vol
cephfs:
monitors:
- "192.168.1.101"
- "192.168.1.102"
user: admin
secretRef:
name: ceph-secret
readOnly: false
path: "/my-fs2"
在上述配置中,我们通过 path 参数指定了要挂载的具体文件系统路径为 /my-fs2。这样就能够将特定的 CephFS 文件系统挂载到 Kubernetes 中的 Pod 中了。




