首页 文章

使用cephfs的kubernetes pod volume

提问于
浏览
0

我按照这个例子来创建带有音量的pod,https://github.com/kubernetes/kubernetes/blob/master/examples/cephfs/cephfs.yaml,我觉得对我来说有些不对劲 .

码头检查:

“/ mnt / cephfs”:“/ var / lib / kubelet / pods / 7631bff0-7155-11e5-9e8a-000c29de7e43 /volumes / kubernetes.io~empty-dir / emphfs”

而我的yaml是:

apiVersion: v1
kind: Pod
metadata:
  name: cephfs
spec:
  containers:
  - name: cephfs-rw
    image: centosphpok
    volumeMounts:
    - mountPath: "/mnt/cephfs"
      name: cephfs
  volumes:
  - name: cephfs
    cephfs:
      monitors:
      - 10.0.0.206:6789
      user: admin
      secretFile: "/etc/ceph/admin.secret"
      readOnly: true

1 回答

  • 0

    您可能尝试的一件事是同时使用secretFile属性和创建Kubernetes Secret对象 .

    这就是我的PersistentVolume的样子:

    kind: PersistentVolume
    apiVersion: v1
    metadata:
      name: oracle
      labels:
        type: rbd
    spec:
      capacity:
        storage: 10Gi
      accessModes:
        - ReadWriteOnce
      rbd:
        pool: rbd
        image: oracle
        user: admin
        keyring: "/etc/ceph/ceph.client.admin.keyring"
        secretRef:
          name: ceph-secret
        fsType: ext4
        readOnly: false
        monitors:
          - "23.23.23.48:6789"
          - "23.23.23.51:6789"
          - "23.23.23.56:6789"
    

    这是我的秘密:

    apiVersion: v1
    kind: Secret
    metadata:
        name: ceph-secret
        data:
            key: AQCChg1WULlLGRAAVB+ws+Uo5FslFPdy338KJg==
    

相关问题