preface

In articlehttps://blog.csdn.net/saynaihe/article/details/115187298Kubeadm builds a highly available HA cluster, and the next measures to consider are storage and exposing services to the outside world. Log collection, monitoring and alarm several items. Personal habits are the first to discuss storage priorities.

About storing StorageClass

Such ashttps://kubernetes.io/zh/docs/concepts/storage/storage-classesAs shown, there are many common types, as follows:



Since my cluster is built on the public cloud, Tencent cloud has open source CSI component of CBS. I used the open source components of Tencent Cloud in the environment of Kubernetes1.16-1.18 when I used Docker to do runtime. This is used again. Convenient integration.

The initial conditions

To: https://editor.csdn.net/md/?articleId=115187298

The host name ip system The kernel
sh-master-01 10.3.2.5  centos8 4.18.0-240.15.1. El8_3. X86_64
sh-master-02 10.3.2.13 centos8 4.18.0-240.15.1. El8_3. X86_64
sh-master-03 10.3.2.16 centos8 4.18.0-240.15.1. El8_3. X86_64
sh-work-01 10.3.2.2 centos8 4.18.0-240.15.1. El8_3. X86_64
sh-work-02 10.3.2.2 centos8 4.18.0-240.15.1. El8_3. X86_64
sh-work-03 10.3.2.4 centos8 4.18.0-240.15.1. El8_3. X86_64

Integrate Tencent Cloud CBS CSI

1. The clone warehouse

Note: The Kubernetes-CSI – TencentCloud includes CBS CSI, CFS CSI and COSFS CSI. Here I’m just using CBS blocks for storage. The other two have also been used, and they still don’t feel very suitable.

git clone https://github.com/TencentCloud/kubernetes-csi-tencentcloud.git

All kinds of nouns can consult: https://github.com/TencentCloud/kubernetes-csi-tencentcloud/blob/master/docs/README_CBS_zhCN.md.

2. Refer to the previous requirements of the document to complete the configuration modification of Kubernetes cluster

1. The master node

With reference tohttps://github.com/TencentCloud/kubernetes-csi-tencentcloud/blob/master/docs/README_CBS_zhCN.md. Refer to the pre-image requirements

Yaml kube-controller-manager. Yaml kube-scheduler. Yaml kube-scheduler. Add the following configuration (see the corresponding version of the corresponding requirements)

 - --feature-gates=VolumeSnapshotDataSource=true





2. Modify the Kubelet configuration for all nodes

–feature-gates=VolumeSnapshotDataSource=true

3. Deploy the CBS CSI plug-in

Create Kubernetes Secret with Tencent Cloud API Credential:

1. The premise:

Above all in Tencent cloud backgroundhttps://console.cloud.tencent.com/camTo create a user, I only opened programming access, as for user permissions, we need to open CBS related permissions. I am directly bound CSB two default related permissions, as well as financial payment permissions, remember certain support for payment, otherwise the hard disk can not create…… . Play the good can be created from the definition of the next authority, otherwise the personal feel financial authority seems a little big……



2. Generate Kubernetes Secret by transferring Secretid SecretKey Base64 according to the documentation prompts

echo -n "XXXXXXXXXXX" |base6
 echo -n "XXXXXXXXXX" |base64

Write base64 to the secret.yaml file

cd /root/kubernetes-csi-tencentcloud-master/deploy/cbs/kubernetes
kubectl apply -f secret.yaml

Note:Project is in the root directory of the git clone, CD/root/kubernetes – csi – tencentcloud – master/deploy/CBS/kubernetes. Including the ones without special emphasis on the directory, are all executed in this directory

2. Create the rbac

Create attacher, provisioner, rbac plugin needs:

kubectl apply -f  csi-controller-rbac.yaml
kubectl apply -f  csi-node-rbac.yaml

Create Controller, Node and Plugin

Create Controller Plugin and Node Plugin

Yaml kubectl apply-f csi-node.yaml ### snapshot-crd:.... kubectl apply -f snapshot-crd.yaml

Kubectl get the pods – n kube – system can see CBS – csi related components to create ing:

4. Verify

Switch catalog CD/root/kubernetes – csi – tencentcloud – master/deploy/CBS/examples

  1. Modify storageClass -basic.yaml with reference to the storageClass parameter

STORAGeClass: kubectl apply-f storageclass-basic.yaml: kubectl apply-f kubectl apply -f app.yaml



Well kubectl get storageclass



At this point, build other applications can use CBS storage. Specific parameters to see the document to see the document to see the document to say three times.