使用cephfs的kubernetes pod volume

时间:2015-10-13 03:10:53

标签: kubernetes ceph

我按照这个例子来创建带有音量的pod, https://github.com/kubernetes/kubernetes/blob/master/examples/cephfs/cephfs.yaml,我觉得我错了。

docker inspect:

" / mnt / cephfs":" /var/lib/kubelet/pods/7631bff0-7155-11e5-9e8a-000c29de7e43/volumes/kubernetes.io~empty-dir/cephfs&# 34;

我的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 :(得分: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==