DataExport
Subcommand for the command line client for Deckhouse.
The export target is referenced by kind (targetRef.kind, the API group is
derived from it). Supported target kinds and their CLI aliases:
| Kind |
Aliases |
PersistentVolumeClaim |
pvc, persistentvolumeclaim |
VolumeSnapshot |
vs, volumesnapshot |
VirtualDisk |
vd, virtualdisk |
VirtualDiskSnapshot |
vds, virtualdisksnapshot |
Available Commands:
- create - Create k8s DataExport object.
Examples
create
d8 data create export-name pvc/test-pvc-name
create from a snapshot
- Enable snapshot-controller module
kubectl apply -f -<<EOF
apiVersion: deckhouse.io/v1alpha1
kind: ModuleConfig
metadata:
name: snapshot-controller
spec:
enabled: true
version: 1
EOF
- Get a volume snapshot class name - this entity is created automatically for each type of CSI and is needed for creating a snapshot.
For example, "sds-local-volume-snapshot-class" as shown in the example below
kubectl get volumesnapshotclass
sds-local-volume-snapshot-class local.csi.storage.deckhouse.io Delete 22h
- Create a snapshot of a needed volume
kubectl apply -f -<<EOF
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: my-snapshot
namespace: <name of the namespace where the PVC is located>
spec:
volumeSnapshotClassName: <volume snapshot class name>
source:
persistentVolumeClaimName: <name of the PVC to snapshot>
EOF
- Check that snapshot is created normally and ready to use (usually takes a few minutes to be ready):
kubectl -n <name of the namespace> get volumesnapshot my-snapshot
NAMESPACE NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT
<namespace> my-snapshot true test-pvc-for-snapshot 2Gi sds-local-volume-snapshot-class snapcontent-faf2ab1f-891d-4e5e-972c-334a490c99d8
- Create data export from that snapshot using d8 command as shown in the example below
d8 data create export-name vs/my-snapshot