目录

CephCSI系列-00-部署

概述

下面介绍一下如何在 Kubernetes 部署 CephCSI,并且测试验证挂载的功能。

安装

1
2
3
helm repo add ceph-csi https://ceph.github.io/csi-charts
helm pull ceph-csi/ceph-csi-cephfs
tar zxvf ceph-csi-cephfs-3.10.2.tgz

具体的修改如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff ceph-csi-cephfs/values.yaml ceph-csi-cephfs-installed/values.yaml
23,27c23,26
< # csiConfig:
< #   - clusterID: "<cluster-id>"
< #     monitors:
< #       - "<MONValue1>"
< #       - "<MONValue2>"
---
> csiConfig:
>   - clusterID: "43db6952-e4cd-11ee-a269-00e269695ced"
>     monitors:
>       - "192.168.1.201:6789"
31c30
< csiConfig: []
---
> # csiConfig: []
123c122
<   replicaCount: 3
---
>   replicaCount: 1
225c224
< # readAffinity:
---
> readAffinity:
228c227
< # enabled: false
---
>  enabled: false
242c241
<   create: false
---
>   create: true
254c253
<   clusterID: <cluster-ID>
---
>   clusterID: 43db6952-e4cd-11ee-a269-00e269695ced
257c256
<   fsName: myfs
---
>   fsName: mycephfs
300c299
<   create: false
---
>   create: true
306,307c305,306
<   adminID: <plaintext ID>
<   adminKey: <Ceph auth key corresponding to ID above>
---
>   adminID: admin
>   adminKey: AQCQo/dlH03jLRAAW/zUhwCCPo84TnN58iKYLw==

测试挂载

通过下面的 yaml 来创建 Pod 能否通过 CephCSI 成功挂载 CephFS 目录。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: cephfs-pvc
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: csi-cephfs-sc
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: cephfs-pod
spec:
  containers:
    - name: cephfs-container
      image: nginx
      volumeMounts:
        - mountPath: "/var/lib/www/html"
          name: cephfs-vol
  volumes:
    - name: cephfs-vol
      persistentVolumeClaim:
        claimName: cephfs-pvc

TroubleShooting

subvolume group ‘csi’ does not exist

需要手动创建。

1
ceph fs subvolumegroup create mycephfs csi

failed to fetch monitor list using clusterID

可能是配置文件关于 fsid 的配置没有填好。

参考资料

  1. CEPHFS ADMINISTRATIVE COMMANDS
  2. ceph-csi-cephfs
  3. CSI CephFS plugin