Alibaba Cloud Disk

Cloud Disk Overview

Cloud disk is a data block-level block storage product provided by Alibaba Cloud for cloud server ECS. It has the characteristics of low latency, high performance, durability, and high reliability.

The cloud disk uses a distributed three-copy mechanism to provide 99.9999999% data reliability guarantee for ECS instances. Supports automatic replication of your data in the availability zone, prevents data unavailability caused by accidental hardware failures, and protects your business from the threat of component failures. Just like a hard disk, you can partition, format, create a file system and other operations on the cloud disk mounted to the ECS instance, and store the data persistently.

More information about cloud disks can be found in Alibaba Cloud Official Document.

Drive Principle

The principle of the Alibaba Cloud Disk Driver is to create a cloud disk instance remotely through the Alibaba Cloud Disk SDK for use by kubernetes. Alibaba Cloud Disk implements a set of Alibaba Cloud CSI plug-ins according to the storage specifications of kubernetes, which can realize the life cycle management of Alibaba Cloud disk storage by kubernetes through the CSI plug-ins. The cloud disk CSI plug-in supports dynamic creation and mounting of cloud disk data volumes. Cloud disk is a type of block storage and can only be used by one load at the same time (ReadWriteOnce).

Driver Installation

Use project alibaba-cloud-csi-driver

git clone && cd alibaba-cloud-csi-driver

Create k8s account

kubectl create -f ./deploy/rbac.yaml

Make sure the account is created successfully

kubectl get sa -n kube-system

Observe that the account description of admin was created successfully

Create csi-plugin
  1. Modify the environment variables ACCESS_KEY_ID and ACCESS_KEY_SECRET two parameters in deploy/disk/disk-plugin.yaml, and replace them with the AccessKey information of the Alibaba Cloud platform account,

  2. The apiVersion of DaemonSet cannot use the version apps/v1beta2, and it can use apps/v1 after testing.

The AccessKey information of the Alibaba Cloud platform account can be applied for on the AccessKey management page of the Alibaba Cloud platform. I won’t repeat it here.

kubectl create -f ./deploy/disk/disk-plugin.yaml

Determine whether the creation is successful

kubectl get ds -n kube-system

Observing that the Ready of csi-diskplugin is 1 indicates that the component is successfully created.

Create a Driver
  1. Modify the environment variables ACCESS_KEY_ID and ACCESS_KEY_SECRET in deploy/disk/disk-provisioner.yaml, and replace them with the accesskey information of the Alibaba Cloud platform account.

  2. In kubernetes version 1.16, the apiVersion of StatefulSet cannot use apps/v1beta1, but after testing, it can use apps/v1

Need to add selector information under spec

      app: csi-disk-provisioner
kubectl create -f ./deploy/disk/disk-provisioner.yaml

Determine if csi-provisioner is created successfully, Ready is 1 to indicate success

kubectl get statefulset -n kube-system

Check the status of csi-plugin

kubectl get pods -n kube-system | grep csi

For more driver installation, please refer to Official Tutorial

Creation of StorageClass

The storageClass has been defined in the project, and it can be used only after modifying it according to the area where the user’s instance is located

A cloud disk can only be mounted to one ECS instance in the same region and in the same Availability Zone**

The ecs used in the test is in Virginia, so we changed the zoneId in the examples/disk/storageclass.yaml file to us-east-1 and the regionId to us-west-1.

kubectl create -f ./examples/disk/storageclass.yaml

Use of Storage

Kato will detect the StorageClass and synchronize it to the database for the Kato console to use as storage type selection; users can go to the Kato console to create state storage and select the newly created Alibaba Cloud disk to test the installation.

After the storage driver is correctly created and the storageClass is created, the user can create stateful components in the Kato console to use Alibaba Cloud Disk Storage. When adding a storage type at this time, you can see the new storage type corresponding to the Alibaba Cloud Disk storageClass. User use.

The minimum storage limit of Alibaba Cloud Disk is 20G. When adding storage, set the minimum storage size to 20G.

After the storage is added, the component must be restarted or updated to trigger the storage to take effect

Test Results

Whether the storage is valid or not can be judged by whether the component can be started normally. The normal start of the component means that the component has normally mounted the storage. You can also go to the Alibaba Cloud Disk Management page to determine the storage status, determine whether there is storage of the corresponding size, and whether its status It is in use.