部署条件
- Rook officially supports v1 snapshots for Kubernetes v1.20+.
- Install the snapshot controller and snapshot v1 CRD as required. More info can be foundhere.
安装快照控制器和CRD:
安装快照 CRD:
git clone https://github.com/kubernetes-csi/external-snapshotter.git
kubectl kustomize /root/crd/external-snapshotter/client/config/crd |kubectl create -f -
安装快照控制器:
kubectl -n kube-system kustomize /root/crd/external-snapshotter/deploy/kubernetes/snapshot-controller | kubectl create -f
安装 CSI 驱动程序:
kubectl kustomize /root/crd/external-snapshotter/deploy/kubernetes/csi-snapshotter/ | kubectl create -f -
CephFS 快照:
拉取镜像
docker pull registry.k8s.io/sig-storage/csi-snapshotter:v6.3.1
docker pull registry.k8s.io/sig-storage/snapshot-controller:v6.3.1
docker pull registry.k8s.io/sig-storage/hostpathplugin:v1.11.0
创建卷快照类
kubectl create -f deploy/examples/csi/cephfs/snapshotclass.yaml
创建卷快照
1、在snapshot.yaml中,volumeSnapshotClassName应该是之前创建类名称
2、persistentVolumeClaimName是 CephFS CSI 驱动程序已创建的 PVC 的名称
kubectl create -f deploy/examples/csi/cephfs/snapshot.yaml
验证 CephFS 快照
READYTOUSE当的字段设置为 true时,快照将准备好恢复到新的 PVC volumesnapshot。
[root@master rook]# kubectl get volumesnapshotclass
NAME DRIVER DELETIONPOLICY AGE
csi-cephfsplugin-snapclass rook-ceph.cephfs.csi.ceph.com Delete 39s
[root@master rook]# kubectl get volumesnapshot
NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE
cephfs-pvc-snapshot true cephfs-pvc 5Gi csi-cephfsplugin-snapclass snapcontent-79f5c87f-ddc1-4263-bfac-42efc9c0b261 40s 41s
将快照恢复到新的 PVC
1、从快照创建新的 PVC,把cephfs-pvc 恢复到cephfs-pvc-restore
2、dataSource:name: cephfs-pvc-snapshot(上一步创建的快照名称)
kubectl create -f deploy/examples/csi/cephfs/pvc-restore.yaml
验证 CephFS 恢复 PVC
[root@master rook]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
cephfs-pvc Bound pvc-adc20c44-9c74-4e28-81d1-a222014e3056 5Gi RWO rook-cephfs 22h
cephfs-pvc-restore Bound pvc-1cf36e3d-6fff-46d2-b2fb-f31f6d67e7d5 5Gi RWX rook-cephfs 63s
RBD 快照:
创建卷快照类
kubectl create -f deploy/examples/c服务器托管网si/rbd/snapshotclass.yaml
创建卷快照
1、上一步创建的类名称:volumeSnapshotClassName: csi-rbdplugin-snapclass
2、备份的pvc名称source:persistentVolumeClaimName: rbd-pvc
kubectl create -f deploy/examples/csi/rbd/snapshot.yaml
验证 RBD 快照创建
READYTOUSE当的字段设置为 true时,快照将准备好恢复到新的 PVC volumesnapshot。
$ kubectl get volumesnapshotclass
NAME DRIVER DELETIONPOLICY AGE
csi-rbdplugin-snapclass rook-ceph.rbd.csi.ceph.com Delete 3h55m
$ kubectl get volumesnapshot
NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE
rbd-pvc-snapshot true rbd-pvc 1Gi csi-rbdplugin-snapclass snapcontent-79090db0-7c66-4b18-bf4a-634772c7cac7 3h50m 3h51m
将快照恢复到新的 PVC
1、从快照创建新的 PVC,把rbd-pvc恢复到rbd-pvc-restore
kubectl create -f deploy/examples/csi/rbd/pvc-restore.yaml
验证 RBD 克隆 PVC 创建
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY 服务器托管网ACCESS MODES STORAGECLASS AGE
rbd-pvc Bound pvc-84294e34-577a-11e9-b34f-525400581048 1Gi RWO rook-ceph-block 34m
rbd-pvc-restore Bound pvc-575537bf-577f-11e9-b34f-525400581048 1Gi RWO rook-ceph-block 8s
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: 腾讯mini项目-【指标监控服务重构-会议记录】2023-07-06
7/6 会议记录 Profile4个步骤 解压kafka消息 初始化性能事件,分析事件 将数据写入kafka Run 开始执行各stage handler 上报耗时到otel-collector 。。。 // ConsumerDispatchHandler c…