|
| 1 | +--- |
| 2 | +layout: blog |
| 3 | +title: 'Announcing Changed Block Tracking API support (alpha)' |
| 4 | +date: 2025-05-14T18:30:00+05:30 |
| 5 | +draft: true |
| 6 | +slug: csi-changed-block-tracking |
| 7 | +author: > |
| 8 | + [Prasad Ghangal](https://github.com/PrasadG193) (Veeam Kasten) |
| 9 | + [Carl Braganza](https://github.com/carlbraganza) (Veeam Kasten) |
| 10 | +--- |
| 11 | + |
| 12 | +We're excited to announce the alpha support for a _changed block tracking_ mechanism. This enhances |
| 13 | +the Kubernetes storage ecosystem by providing an efficient way for |
| 14 | +[CSI](https://kubernetes.io/docs/concepts/storage/volumes/#csi) storage drivers to identify changed |
| 15 | +blocks in PersistentVolume snapshots. With a driver that can use the feature, you could benefit |
| 16 | +from faster and more resource-efficient backup operations. |
| 17 | + |
| 18 | +If you're eager to try this feature, you can [skip to the Getting Started section](#getting-started). |
| 19 | + |
| 20 | +## What is changed block tracking? |
| 21 | + |
| 22 | +Changed block tracking enables storage systems to identify and track modifications at the block level |
| 23 | +between snapshots, eliminating the need to scan entire volumes during backup operations. The |
| 24 | +improvement is a change to the Container Storage Interface (CSI), and also to the storage support |
| 25 | +in Kubernetes itself. |
| 26 | +With the alpha feature enabled, your cluster can: |
| 27 | + |
| 28 | +- Identify allocated blocks within a CSI volume snapshot |
| 29 | +- Determine changed blocks between two snapshots of the same volume |
| 30 | +- Streamline backup operations by focusing only on changed data blocks |
| 31 | + |
| 32 | +For Kubernetes users managing large datasets, this API enables significantly more efficient |
| 33 | +backup processes. Backup applications can now focus only on the blocks that have changed, |
| 34 | +rather than processing entire volumes. |
| 35 | + |
| 36 | +{{< note >}} |
| 37 | +As of now, the Changed Block Tracking API is supported only for block volumes and not for |
| 38 | +file volumes. CSI drivers that manage file-based storage systems will not be able to |
| 39 | +implement this capability. |
| 40 | +{{< /note >}} |
| 41 | + |
| 42 | +## Benefits of changed block tracking support in Kubernetes |
| 43 | + |
| 44 | +As Kubernetes adoption grows for stateful workloads managing critical data, the need for efficient |
| 45 | +backup solutions becomes increasingly important. Traditional full backup approaches face challenges with: |
| 46 | + |
| 47 | +- _Long backup windows_: Full volume backups can take hours for large datasets, making it difficult |
| 48 | + to complete within maintenance windows. |
| 49 | +- _High resource utilization_: Backup operations consume substantial network bandwidth and I/O |
| 50 | + resources, especially for large data volumes and data-intensive applications. |
| 51 | +- _Increased storage costs_: Repetitive full backups store redundant data, causing storage |
| 52 | + requirements to grow linearly even when only a small percentage of data actually changes between |
| 53 | + backups. |
| 54 | + |
| 55 | +The Changed Block Tracking API addresses these challenges by providing native Kubernetes support for |
| 56 | +incremental backup capabilities through the CSI interface. |
| 57 | + |
| 58 | +## Key components |
| 59 | + |
| 60 | +The implementation consists of three primary components: |
| 61 | + |
| 62 | +1. _CSI SnapshotMetadata Service API_: An API, offered by gRPC, that provides volume |
| 63 | + snapshot and changed block data. |
| 64 | +2. _SnapshotMetadataService API_: A Kubernetes CustomResourceDefinition (CRD) that |
| 65 | + advertises CSI driver metadata service availability and connection details to |
| 66 | + cluster clients. |
| 67 | +3. _External Snapshot Metadata Sidecar_: An intermediary component that connects CSI |
| 68 | + drivers to backup applications via a standardized gRPC interface. |
| 69 | + |
| 70 | +## Implementation requirements |
| 71 | + |
| 72 | +### Storage provider responsibilities |
| 73 | + |
| 74 | +If you're an author of a storage integration with Kubernetes and want to support the changed block tracking feature, you must implement specific requirements: |
| 75 | + |
| 76 | +1. _Implement CSI RPCs_: Storage providers need to implement the `SnapshotMetadata` service as defined in the [CSI specifications protobuf](https://github.com/container-storage-interface/spec/blob/master/csi.proto). This service requires server-side streaming implementations for the following RPCs: |
| 77 | + |
| 78 | + - `GetMetadataAllocated`: For identifying allocated blocks in a snapshot |
| 79 | + - `GetMetadataDelta`: For determining changed blocks between two snapshots |
| 80 | + |
| 81 | +2. _Storage backend capabilities_: Ensure the storage backend has the capability to track and report block-level changes. |
| 82 | + |
| 83 | +3. _Deploy external components_: Integrate with the `external-snapshot-metadata` sidecar to expose the snapshot metadata service. |
| 84 | + |
| 85 | +4. _Register custom resource_: Register the `SnapshotMetadataService` resource using a CustomResourceDefinition and create a `SnapshotMetadataService` custom resource that advertises the availability of the metadata service and provides connection details. |
| 86 | + |
| 87 | +5. _Support error handling_: Implement proper error handling for these RPCs according to the CSI specification requirements. |
| 88 | + |
| 89 | +### Backup solution responsibilities |
| 90 | + |
| 91 | +A backup solution looking to leverage this feature must: |
| 92 | + |
| 93 | +1. _Set up authentication_: The backup application must provide a Kubernetes ServiceAccount token when using the |
| 94 | + [Kubernetes SnapshotMetadataService API](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api). |
| 95 | + Appropriate access grants, such as RBAC RoleBindings, must be established to authorize the backup application |
| 96 | + ServiceAccount to obtain such tokens. |
| 97 | + |
| 98 | +2. _Implement streaming client-side code_: Develop clients that implement the streaming gRPC APIs defined in the |
| 99 | + [schema.proto](https://github.com/kubernetes-csi/external-snapshot-metadata/blob/main/proto/schema.proto) file. |
| 100 | + Specifically: |
| 101 | + - Implement streaming client code for `GetMetadataAllocated` and `GetMetadataDelta` methods |
| 102 | + - Handle server-side streaming responses efficiently as the metadata comes in chunks |
| 103 | + - Process the `SnapshotMetadataResponse` message format with proper error handling |
| 104 | + |
| 105 | + The `external-snapshot-metadata` GitHub repository provides a convenient |
| 106 | + [iterator](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/master/pkg/iterator) |
| 107 | + support package to simplify client implementation. |
| 108 | + |
| 109 | +3. _Handle large dataset streaming_: Design clients to efficiently handle large streams of block metadata that |
| 110 | + could be returned for volumes with significant changes. |
| 111 | + |
| 112 | +4. _Optimize backup processes_: Modify backup workflows to use the changed block metadata to identify and only |
| 113 | + transfer changed blocks to make backups more efficient, reducing both backup duration and resource consumption. |
| 114 | + |
| 115 | + |
| 116 | +## Getting started |
| 117 | + |
| 118 | +To use changed block tracking in your cluster: |
| 119 | + |
| 120 | +1. Ensure your CSI driver supports volume snapshots and implements the snapshot metadata capabilities with the required `external-snapshot-metadata` sidecar |
| 121 | +2. Make sure the SnapshotMetadataService custom resource is registered using CRD |
| 122 | +3. Verify the presence of a SnapshotMetadataService custom resource for your CSI driver |
| 123 | +4. Create clients that can access the API using appropriate authentication (via Kubernetes ServiceAccount tokens) |
| 124 | + |
| 125 | +The API provides two main functions: |
| 126 | + |
| 127 | +- `GetMetadataAllocated`: Lists blocks allocated in a single snapshot |
| 128 | +- `GetMetadataDelta`: Lists blocks changed between two snapshots |
| 129 | + |
| 130 | +## What’s next? |
| 131 | + |
| 132 | +Depending on feedback and adoption, the Kubernetes developers hope to push the CSI Snapshot Metadata implementation to Beta in the future releases. |
| 133 | + |
| 134 | +## Where can I learn more? |
| 135 | + |
| 136 | +For those interested in trying out this new feature: |
| 137 | + |
| 138 | +- Official Kubernetes CSI Developer [Documentation](https://kubernetes-csi.github.io/docs/external-snapshot-metadata.html) |
| 139 | +- The [enhancement proposal](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking) for the snapshot metadata feature. |
| 140 | +- [GitHub repository](https://github.com/kubernetes-csi/external-snapshot-metadata) for implementation and release status of `external-snapshot-metadata` |
| 141 | +- Complete gRPC protocol definitions for snapshot metadata API: [schema.proto](https://github.com/kubernetes-csi/external-snapshot-metadata/blob/main/proto/schema.proto) |
| 142 | +- Example snapshot metadata client implementation: [snapshot-metadata-lister](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/main/examples/snapshot-metadata-lister) |
| 143 | +- End-to-end example with csi-hostpath-driver: [example documentation](https://github.com/kubernetes-csi/csi-driver-host-path/blob/master/docs/example-ephemeral.md) |
| 144 | + |
| 145 | + |
| 146 | +## How do I get involved? |
| 147 | + |
| 148 | +This project, like all of Kubernetes, is the result of hard work by many contributors from diverse backgrounds working together. |
| 149 | +On behalf of SIG Storage, I would like to offer a huge thank you to the contributors who helped review the design and implementation of the project, including but not limited to the following: |
| 150 | + |
| 151 | +- Ben Swartzlander ([bswartz](https://github.com/bswartz)) |
| 152 | +- Carl Braganza ([carlbraganza](https://github.com/carlbraganza)) |
| 153 | +- Daniil Fedotov ([hairyhum](https://github.com/hairyhum)) |
| 154 | +- Ivan Sim ([ihcsim](https://github.com/ihcsim)) |
| 155 | +- Nikhil Ladha ([Nikhil-Ladha](https://github.com/Nikhil-Ladha)) |
| 156 | +- Prasad Ghangal ([PrasadG193](https://github.com/PrasadG193)) |
| 157 | +- Praveen M ([iPraveenParihar](https://github.com/iPraveenParihar)) |
| 158 | +- Rakshith R ([Rakshith-R](https://github.com/Rakshith-R)) |
| 159 | +- Xing Yang ([xing-yang](https://github.com/xing-yang)) |
| 160 | + |
| 161 | +Thank also to everyone who has contributed to the project, including others who helped review the |
| 162 | +[KEP](https://github.com/kubernetes/enhancements/pull/4082) and the |
| 163 | +[CSI spec PR](https://github.com/container-storage-interface/spec/pull/551) |
| 164 | + |
| 165 | +For those interested in getting involved with the design and development of CSI or any part of the Kubernetes Storage system, |
| 166 | +join the [Kubernetes Storage Special Interest Group](https://github.com/kubernetes/community/tree/master/sig-storage) (SIG). |
| 167 | +We always welcome new contributors. |
| 168 | + |
| 169 | +The SIG also holds regular [Data Protection Working Group meetings](https://docs.google.com/document/d/15tLCV3csvjHbKb16DVk-mfUmFry_Rlwo-2uG6KNGsfw/edit). |
| 170 | +New attendees are welcome to join our discussions. |
0 commit comments