在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:disk-snapshot开源软件地址:https://gitee.com/AliyunContainerService/disk-snapshot开源软件介绍:Alibaba Cloud Disk Snapshot PluginOverviewAn Disk snapshot plugin is available to help simplify storage management.Once user creates VolumeSnapshot with the reference to a snapshot class, snapshot andcorresponding VolumeSnapshotContent object gets dynamically created and becomes ready to be used byworkloads. This implementation does not depend on CSI feature, but use the csi-snapshot designs which will be used as Alpha feature in k8s 1.13. Disk Snapshot Plugin will create 3 crds as below. volumesnapshotclasses.snapshot.storage.k8s.io: define details to create volumesnapshotcontents, like: storageclass;volumesnapshotcontents.snapshot.storage.k8s.io: define one disk snapshot with the backend, like: pv;volumesnapshots.snapshot.storage.k8s.io: the claim of one snapshot, like: pvc; Requirements
Feature StatusAlpha Compiling and Packagedisk-snapshot can be compiled in a form of a container. To build a container: $ cd build && sh build.sh DeployGet Kubernetes clusterYou can create a Kubernetes Cluster on Alibaba cloud Container Service Kubernetes should be 1.12 or after. Config api-server、controller manager、scheduler compnentsEdit files as below: /etc/kubernetes/manifests/kube-apiserver.yaml/etc/kubernetes/manifests/kube-controller-manager.yaml/etc/kubernetes/manifests/kube-scheduler.yamlAdd: - --feature-gates=CSINodeInfo=true,CSIDriverRegistry=true,VolumeSnapshotDataSource=true
Config Kubelet# vi /etc/systemd/system/kubelet.service.d/10-kubeadm.confAdd:Environment="KUBELET_FEATURE_GATES_ARGS=--feature-gates=CSINodeInfo=true,CSIDriverRegistry=true,VolumeSnapshotDataSource=true" restart kubelet: systemctl daemon-reload && service kubelet restart Deploy Snapshot ControllerIf the cluster not in STS mode, you need to config AK info to plugin; Set ACCESS_KEY_ID, ACCESS_KEY_SECRET to environment; # kubectl create -f ./deploy/snapshot-controller.yaml# kubectl get pod -n kube-system | grep alicloud-disk-snapshotalicloud-disk-snapshot-89c88c7f7-6z95j 2/2 Running 0 42s Deploy SnapshotClass# kubectl create -f ./deploy/snapshotclass.yaml# kubectl get volumesnapshotclasses.snapshot.storage.k8s.ioNAME AGEdefault-snapclass 15s 3 CRDs be created: # kubectl get crd | grep snapvolumesnapshotclasses.snapshot.storage.k8s.io 2019-01-16T12:00:46Zvolumesnapshotcontents.snapshot.storage.k8s.io 2019-01-16T12:00:46Zvolumesnapshots.snapshot.storage.k8s.io 2019-01-16T12:00:46Z UsageCreate Pod with DiskCreate a deployment and pvc, using disk volume. # kubectl create -f ./deploy/deploy-origin.yaml# kubectl get podNAME READY STATUS RESTARTS AGEdynamic-create-7fbf55b58f-qnrgm 1/1 Running 0 21s# kubectl get pvcNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEpvc-disk Bound d-wz9hhnhxu66zs6r6yyyq 20Gi RWO alicloud-disk-ssd 25s# kubectl exec -ti dynamic-create-7fbf55b58f-qnrgm touch /data/snapshot123 Step 4: Create Snapshot with Pvc# kubectl create -f snapshot.yamlvolumesnapshot.snapshot.storage.k8s.io/snapshot-test created# kubectl get volumesnapshots.snapshot.storage.k8s.ioNAME AGEsnapshot-test 2m# kubectl get volumesnapshotcontents.snapshot.storage.k8s.ioNAME AGEsnapcontent-77a75b63-1987-11e9-a520-00163e024341 2m
Create Pvc with Snapshot# kubectl create -f deploy-datasource.yaml# kubectl get podNAME READY STATUS RESTARTS AGEdynamic-create-7fbf55b58f-qnrgm 1/1 Running 0 10mdynamic-snapshot-fdc86b6d8-bl6h5 1/1 Running 0 13s# kubectl get pvcNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEdisk-snapshot Bound d-wz98cj3vphycosrm6joa 20Gi RWO alicloud-disk-ssd 4spvc-disk Bound d-wz9hhnhxu66zs6r6yyyq 20Gi RWO alicloud-disk-ssd 10m# kubectl exec -ti dynamic-snapshot-fdc86b6d8-bl6h5 ls /datalost+found snapshot123 New pvc create a new disk, which using the snapshot. And the new disk contains old disk file(snapshot123). Troubleshooting |
请发表评论