Skip to content

Commit 3f3e5b0

Browse files
committed
Documentation on the external-snaphot-metadata sidecar (alpha).
1 parent 1360f37 commit 3f3e5b0

File tree

4 files changed

+131
-0
lines changed

4 files changed

+131
-0
lines changed

book/src/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [cluster-driver-registrar](cluster-driver-registrar.md) (deprecated)
1919
- [external-health-monitor-controller](external-health-monitor-controller.md)
2020
- [external-health-monitor-agent](external-health-monitor-agent.md)
21+
- [external-snapshot-metadata](external-snapshot-metadata.md)
2122
- [CSI objects](csi-objects.md)
2223
- [CSIDriver Object](csi-driver-object.md)
2324
- [CSINode Object](csi-node-object.md)
@@ -43,6 +44,7 @@
4344
- [CSI Windows](csi-windows.md)
4445
- [Volume Mode Conversion](prevent-volume-mode-conversion.md)
4546
- [Cross-Namespace Data Sources](cross-namespace-data-sources.md)
47+
- [Changed Block Tracking](changed-block-tracking.md)
4648
- [Deploying a CSI Driver on Kubernetes](deploying.md)
4749
- [Example](example.md)
4850
- [Driver Testing](testing-drivers.md)

book/src/changed-block-tracking.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Changed Block Tracking
2+
3+
## Status
4+
5+
Status | Min K8s Version | Max K8s Version | Min CSI Version | Max CSI Version |
6+
-------|-----------------|-----------------|-----------------|-----------------|
7+
Alpha | 1.32 | - | [v1.10.0](https://github.com/container-storage-interface/spec/releases/tag/v1.10.0) | -
8+
9+
10+
## Overview
11+
12+
This optional feature provides a secure mechanism to obtain metadata
13+
on the allocated blocks of a CSI VolumeSnapshot, or the changed blocks between two arbitrary pairs of CSI VolumeSnapshot objects of the same PersistentVolume.
14+
15+
A CSI driver must advertise its support for this feature by specifying the
16+
`SNAPSHOT_METADATA_SERVICE` capability in the response of the
17+
[GetPluginCapabilities](https://github.com/container-storage-interface/spec/blob/master/spec.md#getplugincapabilities)
18+
RPC (part of the CSI
19+
[Identity Service](https://github.com/container-storage-interface/spec/blob/master/spec.md#identity-service-rpc)),
20+
and must implement the CSI
21+
[SnapshotMetadata Service](https://github.com/container-storage-interface/spec/blob/master/spec.md#snapshot-metadata-service-rpcs).
22+
23+
CSI drivers that implement this feature should deploy the
24+
[external-snapshot-metadata](./external-snapshot-metadata.md)
25+
sidecar and create the associated
26+
[Snapshot Metadata Service CR](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#snapshot-metadata-service-custom-resource).
27+
The sidecar provides the
28+
[Kubernetes SnapshotMetadata gRPC service](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api)
29+
that Kubernetes backup applications directly interact with to obtain VolumeSnapshot metadata.
30+
31+
> See [Kubernetes Enhancement Proposal 3314](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking)
32+
> for details of the Changed Block Tracking feature.

book/src/example.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,13 @@ The [deployment example](https://github.com/kubernetes-csi/csi-driver-host-path#
55

66
The example deployment uses the original RBAC rule files that are maintained together with sidecar apps and deploys into the default namespace. A real production should copy the RBAC files and customize them as explained in the comments of those files.
77

8+
The Hostpath CSI driver only supports the [Changed Block Tracking](./changed-block-tracking.md) feature for
9+
PersistentVolumes with `Block` VolumeMode.
10+
The support is not enabled by default, but requires additional configuration when deploying the driver.
11+
When enabled, the
12+
[external-snapshot-metadata](./external-snapshot-metadata.md)
13+
sidecar will also be deployed, and the additional RBAC policies needed will get created.
14+
See the [docs/example-snapshot-metadata.md](https://github.com/kubernetes-csi/csi-driver-host-path/blob/master/docs/example-snapshot-metadata.md)
15+
document for details.
16+
817
If you encounter any problems, please check the [Troubleshooting page](troubleshooting.html).
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# CSI external-snapshot-metadata
2+
3+
## Status and Releases
4+
5+
**Git Repository:** [https://github.com/kubernetes-csi/external-snapshot-metadata](https://github.com/kubernetes-csi/external-snapshot-metadata)
6+
7+
### Supported Versions
8+
9+
Latest stable release | Branch | Min CSI Version | Max CSI Version | Container Image | [Min K8s Version](project-policies.md#minimum-version) | [Max K8s Version](project-policies.md#maximum-version) | [Recommended K8s Version](project-policies.md#recommended-version) |
10+
--|--|--|--|--|--|--|--
11+
v0.1.0 | [v0.1.0](https://github.com/kubernetes-csi/external-snapshot-metadata/releases/tag/v0.1.0) | [v1.10.0](https://github.com/container-storage-interface/spec/releases/tag/v1.10.0) | - | gcr.io/k8s-staging-sig-storage/csi-snapshot-metadata:v0.1.0 | v1.32 | - | v1.32
12+
13+
14+
## Alpha
15+
16+
### Description
17+
This sidecar securely serves snapshot metadata to Kubernetes clients through the
18+
[Kubernetes SnapshotMetadata gRPC Service](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api).
19+
20+
The sidecar authenticates and authorizes each Kubernetes backup application request made through the
21+
Kubernetes SnapshotMetadata gRPC Service API.
22+
It then acts as a proxy as it fetches the desired metadata from the CSI driver and
23+
streams it directly to the requesting application with no load on the Kubernetes API server.
24+
25+
See ["The External Snapshot Metadata Sidecar"](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-external-snapshot-metadata-sidecar)
26+
section in the CSI Changed Block Tracking KEP for additional details on the sidecar.
27+
28+
### Usage
29+
Backup applications, identified by their authorized ServiceAccount objects,
30+
directly communicate with the sidecar using the
31+
[Kubernetes SnapshotMetadata gRPC Service](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api).
32+
The authorization needed is described in the
33+
["Risks and Mitigations"](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#risks-and-mitigations)
34+
section of the CSI Changed Block Tracking KEP.
35+
In particular, this requires the ability to use the Kubernetes
36+
[TokenRequest](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-request-v1/)
37+
API and to access the objects required to use the service.
38+
39+
The existence of this optional service is advertised by the presence of a
40+
[Snapshot Metadata Service CR](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#snapshot-metadata-service-custom-resource),
41+
named for the CSI driver that provisions the PersistentVolume and VolumeSnapshot objects involved.
42+
The CR contains the service endpoint and CA certificate, and an audience string for authentication.
43+
The backup application must use the Kubernetes
44+
[TokenRequest](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-request-v1/)
45+
API with the audience string to obtain a Kubernetes authentication token for use in the
46+
Kubernetes SnapshotMetadata gRPC Service call.
47+
The backup application should establish trust for the CA certificate before making the gRPC call
48+
to the service endpoint.
49+
VolumeSnapshot metadata can be lengthy, and the Kubernetes SnapshotMetadata gRPC Service supports
50+
restarting an interrupted metadata request from an intermediate point in case of failure.
51+
52+
The sidecar repository contains a
53+
[snapshot-metadata-lister](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/master/examples/snapshot-metadata-lister)
54+
example command that illustrates the use of the Kubernetes SnapshotMetadata gRPC Service in a Go application.
55+
It uses the
56+
[pkg/iterator](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/master/pkg/iterator)
57+
utility package, which may be used by backup applications if desired.
58+
59+
### Deployment
60+
The CSI `external-snapshot-metadata` sidecar should be deployed by
61+
CSI drivers that support the
62+
[Changed Block Tracking](./changed-block-tracking.md) feature.
63+
The sidecar must be deployed in the same pod as the CSI driver and
64+
will communicate with its CSI [SnapshotMetadata](https://github.com/container-storage-interface/spec/blob/master/spec.md#snapshot-metadata-service-rpcs)
65+
and [Identity](https://github.com/container-storage-interface/spec/blob/master/spec.md#identity-service-rpc) gRPC services
66+
over a UNIX domain socket.
67+
68+
The sidecar should be configured to run under the authority of its
69+
CSI driver ServiceAccount, which must be authorized as described in the
70+
["Risks and Mitigations"](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#risks-and-mitigations)
71+
section of the CSI Changed Block Tracking KEP.
72+
In particular, this requires the ability to use the Kubernetes
73+
[TokenReview](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/)
74+
and
75+
[SubjectAccessReview](https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/subject-access-review-v1/)
76+
APIs.
77+
78+
A Service object must be created for the TCP based [Kubernetes SnapshotMetadata](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api)
79+
gRPC service implemented by the sidecar.
80+
81+
A [SnapshotMetadataService CR](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#snapshot-metadata-service-custom-resource),
82+
named for the CSI driver, must be created to advertise the
83+
availability of this optional feature.
84+
The CR contains the CA certificate and Service endpoint address
85+
of the sidecar and the audience string needed for the client
86+
authentication token.
87+
88+
See the sample [Hostpath CSI driver](example.md) for an illustration on how to deploy a CSI driver.

0 commit comments

Comments
 (0)