存储包括共享存储和本地存储。
•共享存储支持chiwenfs和nfs-csi两种存储方式,可按需安装存储。如需平台具备高可用性,必须使用共享存储。
▪chiwenfs
chiwenfs为部署容器云平台提供支持的一种K8s集群内置存储,部署后,K8S集群将该存储会指向每个平台集群节点,形成本地分布式存储。
说明 |
---|
chiwenfs不支持ARM架构。 |
▪nfs-csi
nfs-csi是一种K8s的NFS动态存储。
•本地存储,支持本地PV的方式。
•已安装K8s集群。
•集群K8s版本必须为1.26.15版本。
1.通过SSH登录集群管理节点。
2.执行以下命令,安装chiwenfs。
sudo ./mycp_deploy.sh chiwenfs-install
回显如下类似信息:
Confirm('Y' or 'y') or Cancel('N' or 'n'):
确认当前系统的时间是否正确,确认输入“Y”或者“y”,取消则按“N”或“n”。输入“y”,按回车键继续。
3.待安装完成后,执行kubectl get po -A,可查看已安装存储的状态,当STATUS列均为Running时 ,则表明存储相关服务已经挂起。
1.通过SSH登录集群管理节点。
2.进入nfs-csi目录。
3.在nfs-csi目录下执行以下命令,安装nfs-csi的相关组件。
./install.sh x86_64 ${镜像仓库地址}
如使用自建集群,示例如下:
./install.sh x86_64 sealos.hub:5000
当出现以下回显信息,则安装成功。
deployment.apps/csi-nfs-controller created
+ kubectl apply -f ./yaml-release/csi-nfs-node.yaml
daemonset.apps/csi-nfs-node created
+ echo 'NFS CSI driver installed successfully.'
NFS CSI driver installed successfully.
4.在csi-yaml-tmpl/storageclass-nfs.yaml文件中,填写server(nfs server)及share(nfs目录)信息。
5.执行以下命令,创建nfs storageclass。
kubectl apply -f csi-yaml-tmpl/storageclass-nfs.yaml
当出现以下回显信息,则创建成功。
storageclass.storage.k8s.io/nfs-csi created
需提前准备hostpath.yaml文件。
1.通过SSH登录集群管理节点。
2.进入nfs-csi目录。执行以下命令,配置本地PV。
kubectl apply -f hostpath.yaml
当出现以下回显信息,则配置完成。
persistentvolume/stack-etcd created
persistentvolume/stack-mysql created
persistentvolume/stack-keystone created
persistentvolume/stack-registry created
persistentvolume/stack-prometheus created
persistentvolume/stack-alertmanager created
persistentvolume/stack-web created
persistentvolume/stack-chiwen created
persistentvolume/stack-offlineregistry created
persistentvolume/stack-chartmuseum created
persistentvolume/stack-jenkins-master created
persistentvolume/stack-postgres created
persistentvolume/stack-clair created