1

It's working when I use volumes of cephfs . path is /test and user is test

apiVersion: v1
kind: Pod
metadata:
  name: cephfs
spec:
  containers:
  - name: cephfs
    image: kubernetes/pause
    volumeMounts:
    - mountPath: "/mnt/cephfs"
      name: cephfs
  volumes:
  - name: cephfs
    cephfs:
      monitors:
      - 10.16.154.78:6789
      - 10.16.154.82:6789
      - 10.16.154.83:6789
      path: /test
      user: test
      secretRef:
        name: ceph-test
      readOnly: true

but it's not working when I create a StorageClass like this

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: cephfs
provisioner: ceph.com/cephfs
parameters:
  monitors: 10.16.154.78:6789,10.16.154.82:6789,10.16.154.73:6789
  adminId: test
  adminSecretName: ceph-test
  adminSecretNamespace: default

I think there is no support of parameters "path" , how can I transmit path: /test to the StorageClass yaml?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
faithfull
  • 151
  • 1
  • 4
  • As per the example here: "https://github.com/kubernetes-incubator/external-storage/tree/master/ceph/cephfs/example" you need to create a pvc using the storage class name and then use the pvc name in your pod volume. – Ashik Feb 13 '20 at 08:38

1 Answers1

0

There is claimRoot, you can see the usage in this example.

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: cephfs
provisioner: ceph.com/cephfs
parameters:
    monitors: 172.24.0.6:6789
    adminId: admin
    adminSecretName: ceph-secret-admin
    adminSecretNamespace: "kube-system"
    claimRoot: /pvc-volumes

Also maybe this blog post might be of help to you.

Crou
  • 10,232
  • 2
  • 26
  • 31