kubernetes use persistent storage Ali cloud cpfs

Brief introduction

cpfs specific description herein may refer to:
https://help.aliyun.com/document_detail/111755.html?spm=a2c4g.11174283.3.1.1275c6eclqO43j

To use cpfs storage, cpfs need to install a client on all k8s nodes. To install cpfs client itself is not complicated, but it depends on what people annoying.

It depends on the kernel-devel, but also requires kernel, kernel-devel kernel-headers, and must be done consistent version.

I use the time, encountered a kernel version is lower than the kernel-devel version of the problem, due to the current yum sources have been updated version of the kernel-devel, and can not find a low version of the kernel-devel, and so I had to updated kernel and kernel-headers. The problem is updated maybe stuff, you have to reboot the system. More than one machine, have a big head.

Client installation cpfs

The following is a brief speech during installation cpfs client:

  1. cpfs client installation
# 保持kernel kernel-devel kernel-headers的版本一致
sudo yum update kernel-devel kernel-headers

sudo yum install -y make gcc libyaml-devel libtool zlib-devel glibc-headers dkms expect

wget https://cpfs-client.oss-cn-beijing.aliyuncs.com/centos/cpfs-client-2.10.8-202.el7.tar.gz

tar xf cpfs-client-2.10.8-202.el7.tar.gz

# 这一步大概需要等待5-10分钟
sudo rpm -vih  cpfs-client-dkms-1.0.0-202.el7.noarch.rpm
sudo rpm -vih cpfs-client-2.10.8-202.el7.x86_64.rpm

In my environment, before installing an older version of cpfs client, a lot of problems, not now installed a new law to take effect, have to clean up the old:


rpm -e lustre-client kmod-lustre-client

sudo lustre_rmmod;  sudo modprobe lustre
  1. Local mount verification:
vim /etc/cpfs/cpfs-mounts.conf

xxx.cn-beijing.cpfs.nas.aliyuncs.com@tcp:xxx.cn-beijing.cpfs.nas.aliyuncs.com@tcp:/xxx


/etc/init.d/cpfs-client start
systemctl enable cpfs-client

This step is no problem, then it means that the client properly installed.

kubernetes use cfs as persistent storage

  1. Creating pv:
apiVersion: v1
kind: PersistentVolume
metadata:
  name: cpfs-pv
spec:
  capacity:
    storage: 5Ti
  accessModes:
    - ReadWriteMany
  flexVolume:
    driver: "alicloud/cpfs"
    options:
      server: xxx.cn-beijing.cpfs.nas.aliyuncs.com@tcp:xxx.cn-beijing.cpfs.nas.aliyuncs.com@tcp
      fileSystem: xxx
  1. Creating pvc:
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: cpfs-pvc
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 5Ti

In addition a mouth any more, this cpfs docked in kubernetes, use is flexvolume, Ali cloud here also recommends upgrading to version flexvolume plug: v1.14.6.19-e986f6e-aliyun

Guess you like

Origin www.cnblogs.com/breezey/p/11891897.html