|
| 1 | +# Guide for RBD Deployment with CSI Snapshot-Metadata Sidecar |
| 2 | + |
| 3 | +> ⚠️ **Warning - Alpha Feature**: |
| 4 | +> This feature is currently in **alpha** and is subject to change in future releases. |
| 5 | +> This feature should only be used for testing and evaluation purposes. |
| 6 | +
|
| 7 | +[KEP-3314](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking) |
| 8 | +introduces new CSI APIs to identify changed blocks between snapshots of CSI volumes. |
| 9 | +These APIs enable efficient and incremental backups by allowing backup applications |
| 10 | +to retrieve only the data that has changed. |
| 11 | + |
| 12 | +To support this feature, Ceph-CSI should include an `external-snapshot-metadata` |
| 13 | +sidecar in the RBD controller plugin. |
| 14 | + |
| 15 | +This document outlines how the Ceph-CSI Operator manages the deployment |
| 16 | +of the RBD controller plugin with the `external-snapshot-metadata` sidecar. |
| 17 | + |
| 18 | +(_Note: Only the RBD driver supports the SnapshotMetadata capability._) |
| 19 | + |
| 20 | +## Admin Responsibilities |
| 21 | + |
| 22 | +Users need to perform the following manual setup: |
| 23 | + |
| 24 | +1. Install the [SnapshotMetadataService CRD](https://github.com/kubernetes-csi/external-snapshot-metadata/blob/v0.1.0/client/config/crd/cbt.storage.k8s.io_snapshotmetadataservices.yaml) |
| 25 | + |
| 26 | + ```bash |
| 27 | + kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshot-metadata/refs/tags/v0.1.0/client/config/crd/cbt.storage.k8s.io_snapshotmetadataservices.yaml |
| 28 | + ``` |
| 29 | + |
| 30 | +2. Create a Service to expose the RBD driver pod |
| 31 | + |
| 32 | + Create a service to enable communication with the RBD controller plugin: |
| 33 | + |
| 34 | + ```yaml |
| 35 | + apiVersion: v1 |
| 36 | + kind: Service |
| 37 | + metadata: |
| 38 | + name: <service-name> |
| 39 | + namespace: <driver-namespace> |
| 40 | + spec: |
| 41 | + ports: |
| 42 | + - name: snapshot-metadata-port |
| 43 | + port: <service-port> |
| 44 | + protocol: TCP |
| 45 | + targetPort: 50051 # should be the same as the sidecar uses this port for its gRPC server |
| 46 | + selector: |
| 47 | + app: <driver-name>-ctrlplugin # RBD controller plugin pod label |
| 48 | + type: ClusterIP |
| 49 | + ``` |
| 50 | +
|
| 51 | + > **Note:** |
| 52 | + > - Replace `<service-name>` with your desired service name (e.g., `rbd-csi-ceph-com-metadata`) |
| 53 | + > - Replace `<driver-namespace>` with the namespace where your RBD driver is deployed |
| 54 | + > - Replace `<service-port>` with your desired service port (e.g., `6443`) |
| 55 | + > - Replace `<driver-name>` with your RBD driver name (e.g., `rbd.csi.ceph.com`) |
| 56 | + |
| 57 | +3. Provision TLS certificates and create a TLS secret |
| 58 | + |
| 59 | + Generate TLS certificates using your preferred method (self-signed, cert-manager, etc). |
| 60 | + The certificates must be valid for the service domain created in step 2: `<service-name>.<driver-namespace>` |
| 61 | + |
| 62 | + Create a TLS secret with the generated certificates: |
| 63 | + |
| 64 | + ```bash |
| 65 | + kubectl create secret tls <driver-name> \ |
| 66 | + --namespace=<driver-namespace> \ |
| 67 | + --cert=server-cert.pem \ |
| 68 | + --key=server-key.pem |
| 69 | + ``` |
| 70 | + |
| 71 | + > **Note:** |
| 72 | + > - Replace `<driver-name>` with your RBD driver name (e.g., `rbd.csi.ceph.com`) |
| 73 | + > - Replace `<driver-namespace>` with the namespace where your RBD driver is deployed |
| 74 | + > - Ensure certificates are valid for the domain: `<service-name>.<driver-namespace>` (using the service name from step 2) |
| 75 | + |
| 76 | +4. Create a SnapshotMetadataService CR for the RBD driver that will deploy the `external-snapshot-metadata` sidecar. |
| 77 | + The name of this CR must match the RBD driver CR name. |
| 78 | + |
| 79 | + **Example:** |
| 80 | + |
| 81 | + ```yaml |
| 82 | + apiVersion: cbt.storage.k8s.io/v1alpha1 |
| 83 | + kind: SnapshotMetadataService |
| 84 | + metadata: |
| 85 | + name: <driver-name> |
| 86 | + spec: |
| 87 | + address: <service-name>.<driver-namespace>:<service-port> |
| 88 | + audience: <driver-name> |
| 89 | + caCert: <ca-bundle> |
| 90 | + ``` |
| 91 | + |
| 92 | + > **Note:** |
| 93 | + > - `address`: Should point to the service created in step 2, replace `<service-name>`, `<driver-namespace>`, and `<service-port>` with your actual values from step 2 |
| 94 | + > - `audience`: Recommended to use the CSI driver name for consistency |
| 95 | + > - `caCert`: Base64-encoded CA certificate bundle |
| 96 | + |
| 97 | +5. Provide the TLS secret required for the `external-snapshot-metadata` sidecar as a volume mount in the RBD driver CR. |
| 98 | + |
| 99 | + **Example:** |
| 100 | + |
| 101 | + ```yaml |
| 102 | + apiVersion: csi.ceph.io/v1 |
| 103 | + kind: Driver |
| 104 | + metadata: |
| 105 | + name: <driver-name> |
| 106 | + namespace: <driver-namespace> |
| 107 | + spec: |
| 108 | + # ... other fields ... |
| 109 | + controllerPlugin: |
| 110 | + volumes: |
| 111 | + - mount: |
| 112 | + mountPath: /tmp/certificates # Must be /tmp/certificates - required by sidecar |
| 113 | + name: tls-key |
| 114 | + volume: |
| 115 | + name: tls-key # Must be "tls-key" |
| 116 | + secret: |
| 117 | + secretName: snapshot-metadata-tls # The TLS secret name |
| 118 | + ``` |
| 119 | + |
| 120 | + > **Note:** |
| 121 | + > - **mountPath must be `/tmp/certificates`**: This path is required by the snapshot metadata sidecar to locate TLS certificates. |
| 122 | + > - **Volume name and mount name must be `tls-key`**: The operator specifically filters for volumes with this exact name to mount in the snapshot-metadata sidecar container. |
| 123 | + > - Replace `<driver-name>` with your RBD driver name (e.g., `rbd.csi.ceph.com`) |
| 124 | + > - Replace `<driver-namespace>` with the namespace where your RBD driver is deployed |
| 125 | + |
| 126 | +## Ceph-CSI Operator Responsibilities |
| 127 | + |
| 128 | +The operator will perform the following actions for the RBD controller plugin deployment: |
| 129 | + |
| 130 | +- Check for the existence of the SnapshotMetadataService CR (name must be the same as the RBD driver CR) |
| 131 | +- Check for the volume of type SecretVolumeSource (name must be the same as the RBD driver CR) |
| 132 | + |
| 133 | +> ⚠️ **Note**: If the SnapshotMetadataService CR is created after adding the volume configuration |
| 134 | +> in the RBD driver CR, the ceph-csi-operator pod needs to be restarted manually. |
0 commit comments