Press "Enter" to skip to content

k8s使用ceph存储,查找存储卷对应关系。

The mapping in Kubernetes is the following:

PVC <-- PV <-- Storage (Ceph)
kubectl  get pv  获取所有的pv
rbd ls kubernetes  查看所有 k8s在ceph里面申请的块

你会 发现,两边名字对应不上。怎么查找关系呢?

kubectl get pv pvc-c409bdcb-6cea-11e9-8936-9600001d3fab -o yaml


apiVersion: v1
kind: PersistentVolume
metadata:
  annotations:
    pv.kubernetes.io/provisioned-by: ceph.rook.io/block
  creationTimestamp: "2019-05-02T14:58:38Z"
  finalizers:
  - kubernetes.io/pv-protection
  name: pvc-c409bdcb-6cea-11e9-8936-9600001d3fab
  resourceVersion: "10504117"
  selfLink: /api/v1/persistentvolumes/pvc-c409bdcb-6cea-11e9-8936-9600001d3fab
  uid: c453d6f5-6cea-11e9-a067-9600001d3fa9
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 150Gi
  claimRef:
    apiVersion: v1
    kind: PersistentVolumeClaim
    name: REDACTED
    namespace: REDACTED
    resourceVersion: "10504100"
    uid: c409bdcb-6cea-11e9-8936-9600001d3fab
  flexVolume:
    driver: ceph.rook.io/rook-ceph-system
    fsType: xfs
    options:
      clusterNamespace: rook-ceph
      dataBlockPool: ""
      image: pvc-c409bdcb-6cea-11e9-8936-9600001d3fab
      pool: block-repl-3-1
      storageClass: rook-ceph-block-repl-3-1
  persistentVolumeReclaimPolicy: Delete
  storageClassName: rook-ceph-block-repl-3-1
  volumeMode: Filesystem
status:
  phase: Bound

通过 kubectl get pv pvc-c409bdcb-6cea-11e9-8936-9600001d3fab -o yaml 命令查询pv的详细信息,里面能看到挂载的那个ceph块。

参考资料:https://github.com/rook/rook/issues/3427

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注