在CentOS上部署Kubernetes存储,有多种方案,以下是几种常见存储的配置方法:
sudo yum install -y nfs-utils,创建共享目录/mnt/nfs,设置权限sudo chown -R nobody:nogroup /mnt/nfs,编辑/etc/exports添加/mnt/nfs *(rw,sync,no_subtree_check),启动服务sudo systemctl start nfs-server并设置开机自启sudo systemctl enable nfs-server,最后导出共享目录sudo exportfs -a。nfs-pv.yaml定义持久卷,包含服务器地址、共享路径等信息,创建nfs-pvc.yaml定义持久卷声明,指定访问模式和存储大小,在Pod配置中通过volumes和volumeMounts引用PVC。kubectl和helm。helm repo add rook-release https://charts.rook.io/release,安装Operatorkubectl create namespace rook-ceph,helm install rook-ceph rook-release/rook-ceph --namespace rook-ceph。CephCluster资源定义,指定存储设备等信息,验证集群状态kubectl -n rook-ceph get cephcluster。kubectl apply -f应用配置,之后可在Pod中使用该存储类对应的PVC。yum install -y centos-release-gluster,yum install -y glusterfs-server glusterfs-fuse,初始化集群gluster peer probe <节点IP>。StorageClass,指定provisioner为kubernetes.io/glusterfs,配置相关参数如resturl等。