Available in: Open/CE, Core, SE, SE+, Ultimate/EE
The module lifecycle stage: Generally available version
The module has requirements for installation
Ceph is a scalable distributed storage system that ensures high availability and fault tolerance of data. Deckhouse Kubernetes Platform (DKP) provides Ceph cluster integration using the csi-ceph module. This enables dynamic storage management and the use of StorageClass based on RADOS Block Device (RBD) or CephFS.
Volume snapshots require the storage-foundation module. Without it, the rest of the module keeps working and no VolumeSnapshotClass is created.
This page provides instructions on connecting Ceph to Deckhouse, configuring authentication, creating StorageClass objects, and verifying storage functionality.
Migration from ceph-csi module
When switching from the ceph-csi module to csi-ceph, an automatic migration is performed, but its execution requires preliminary preparation:
-
Set the replica count to zero for all operators (redis, clickhouse, kafka, etc.). Exception: the
prometheusoperator will be disabled automatically. -
Disable the
ceph-csimodule and enablecsi-ceph. -
Wait for the operation to complete. The Deckhouse logs should show the message “Finished migration from Ceph CSI module”.
-
Verify functionality. Create test pods and PVCs to test CSI.
-
Restore the operators to working state.
If Ceph StorageClass was created without using the CephCSIDriver resource, manual migration will be required. Contact technical support.
Network requirements
The module needs access to all components of the Ceph cluster, not only to the monitors. The monitors tell a client the addresses of the other components, and the client then connects to them directly. If only the monitor ports are open, the CephClusterConnection and the CephStorageClass still become Ready, because this condition does not check that Ceph is reachable, but volumes are neither created nor mounted.
| Component | TCP ports | What needs it |
|---|---|---|
| Monitors (mon) | 3300 (messenger protocol msgr2) and 6789 (msgr1) | Every operation. |
| OSD | 6800–7568 | Creating and mounting volumes of both types, and all reads and writes of data. |
| Managers (mgr) | 6800–7568 | Creating and mounting CephFS volumes and deleting RBD volumes. |
| Metadata servers (MDS) | 6800–7568 | Mounting CephFS volumes and working with their files. Not needed if only RBD is used. |
6800–7568 is the default range of the ms_bind_port_min and ms_bind_port_max options of Ceph 17 and later; in Ceph 16 it is 6800–7300. The OSDs, managers and metadata servers of one host take the first free ports of the range and can take other ports after a restart, so open the whole range to every host of the Ceph cluster.
Open the ports:
- from all nodes of the Kubernetes cluster: the
csi-node-rbdandcsi-node-cephfspods run on every node, and the kernel of the node reads and writes the data itself; - from the nodes with the
csi-controller-rbdandcsi-controller-cephfspods: they create and delete volumes and use the network of the node; - for the
controllerpod of the module: it reads the pool space and the RBD image watchers and uses the pod network, not the network of the node.
Both monitor ports and both messenger protocols are needed because different clients use different ones. With monitors listed as <IP>:6789 and msgr2 enabled in Ceph:
| Client | Monitors | Other components |
|---|---|---|
| CSI driver and the controller of the module (librados) | 6789 first, then 3300 | msgr2 |
| RBD volume on a node (kernel) | 3300 | msgr2 |
| CephFS volume on a node (kernel) | 6789 | msgr1 |
When msCrcData is false, the kernel uses msgr1 for RBD volumes as well.
Which port to use in the monitors list
Use port 6789 in spec.monitors, and open port 3300 too:
- Listing only port 3300 is supported for RBD, but does not work for CephFS. The module does not set the
ms_modeoption of the CephFS kernel client, and without it the client speaks msgr1, while port 3300 accepts msgr2 only. Volumes are created, but not mounted: the mount fails after about a minute withmount error: no mds (Metadata Server) is up, and the kernel log of the node showslibceph: mon0 (1)10.0.0.10:3300 socket closed (con state V1_BANNER). - Listing each monitor twice, with port 3300 and with port 6789, works for both volume types, but has no advantage: a CephFS mount takes several seconds longer when the kernel picks an address with port 3300 first.
- Leaving port 3300 closed does not work with any list if the monitors have msgr2 enabled, that is,
ceph mon dumpshows both port 3300 and port 6789 for them. The CSI driver learns the msgr2 addresses from the monitors and does not return to port 6789; the operation fails after 5 minutes withConnection timed out.
To find a closed port, see the FAQ.
Connecting to a Ceph cluster
To connect to a Ceph cluster, follow the step-by-step instructions below. Execute all commands on a machine with administrative access to the Kubernetes API.
-
Execute the command to activate the
csi-cephmodule:d8 s module enable csi-ceph -
Wait for the module to transition to
Readystate:d8 k get module csi-ceph -w -
Ensure that all pods in the
d8-csi-cephnamespace are inRunningorCompletedstate and deployed on all cluster nodes:d8 k -n d8-csi-ceph get pod -owide -w -
To configure the connection to the Ceph cluster, apply the CephClusterConnection resource.
Example command:
d8 k apply -f - <<EOF apiVersion: storage.deckhouse.io/v1alpha1 kind: CephClusterConnection metadata: name: ceph-cluster-1 spec: # FSID/UUID of the Ceph cluster. # Get the FSID/UUID of the Ceph cluster using the command `ceph fsid`. clusterID: 014df517-39d1-4453-b7b3-9930c563627c # List of IP addresses of ceph-mon in the format 10.0.0.10:6789. monitors: - 10.0.0.10:6789 # Username without `client.`. # Get the username using the command `ceph auth list`. userID: admin # Authorization key corresponding to userID. # Get the authorization key using the command `ceph auth get-key client.admin`. userKey: <your-ceph-auth-key> EOF -
Verify the connection creation with the command (
READYshould beTrue):d8 k get cephclusterconnection ceph-cluster-1 -
Create a StorageClass object using the CephStorageClass resource. Manual creation of StorageClass without using CephStorageClass may lead to errors.
Example of creating StorageClass based on RBD:
d8 k apply -f - <<EOF apiVersion: storage.deckhouse.io/v1alpha1 kind: CephStorageClass metadata: name: ceph-rbd-sc spec: clusterConnectionName: ceph-cluster-1 reclaimPolicy: Delete type: RBD rbd: defaultFSType: ext4 pool: ceph-rbd-pool EOFExample of creating StorageClass based on Ceph filesystem:
d8 k apply -f - <<EOF apiVersion: storage.deckhouse.io/v1alpha1 kind: CephStorageClass metadata: name: ceph-fs-sc spec: clusterConnectionName: ceph-cluster-1 reclaimPolicy: Delete type: CephFS cephFS: fsName: cephfs EOF -
Verify that the created CephStorageClass resources are
Ready:d8 k get cephstorageclassThis will output information about the created CephStorageClass resources:
NAME READY REASON CONNECTION POOL AGE ceph-rbd-sc True Reconciled ceph-cluster-1 ceph-rbd-pool 1h ceph-fs-sc True Reconciled ceph-cluster-1 1h -
Verify the created StorageClass:
d8 k get scThis will output information about the created StorageClass:
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE ceph-rbd-sc rbd.csi.ceph.com Delete Immediate true 15s ceph-fs-sc cephfs.csi.ceph.com Delete Immediate true 15sThe module always creates a StorageClass with the
Immediatevolume binding mode: the volume is provisioned as soon as the PersistentVolumeClaim is created. There is no parameter to change it.
Ceph cluster connection setup is complete. You can use the created StorageClass to create PersistentVolumeClaim in your applications.