9、nfs-subdir-external-provisioner
dockerhub 地址:https://hub.docker.com/r/dyrnq/nfs-subdir-external-provisioner/tags。使用这个镜像:dyrnq/nfs-subdir-external-provisioner:v4.0.2。版本:nfs-subdir-external-provisioner-4.0.18。k8s-1.29.1 持久化存储(nfs动态存储)
·
9、nfs-subdir-external-provisioner
k8s(pv 与 pvc)动态存储 StorageClass
k8s-1.29.1 持久化存储(nfs动态存储)
1、部署nfs
nfs 服务端(k8s-master)
# 所有服务端节点安装nfs
yum -y install nfs-utils
systemctl enable nfs-server rpcbind --now
# 创建nfs共享目录、授权
mkdir -p /data/k8s && chmod -R 777 /data/k8s
# 写入exports
cat > /etc/exports << EOF
/data/k8s 192.168.1.0/24(rw,sync,no_root_squash)
EOF
systemctl reload nfs-server
使用如下命令进行验证
# showmount -e 192.168.1.200
Export list for 192.168.1.200:
/data/k8s 192.168.1.0/24
nfs 客户端(k8s-node)
yum -y install nfs-utils
systemctl enable rpcbind --now
使用如下命令进行验证
# showmount -e 192.168.1.200
Export list for 192.168.1.200:
/data/k8s 192.168.1.0/24
备份
mkdir -p /data/k8s && chmod -R 777 /data/k8s
rsync -avzP /data/k8s root@192.168.1.203:/data
00 2 * * * rsync -avz /data/k8s root@192.168.1.203:/data &>/dev/null
2、动态创建 NFS存储(动态存储)
https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner
mkdir ~/nfs-subdir-external-provisioner-4.0.18 && cd ~/nfs-subdir-external-provisioner-4.0.18
版本:nfs-subdir-external-provisioner-4.0.18
https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/tree/nfs-subdir-external-provisioner-4.0.18/deploy
wget https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/raw/nfs-subdir-external-provisioner-4.0.18/deploy/deployment.yaml
wget https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/raw/nfs-subdir-external-provisioner-4.0.18/deploy/rbac.yaml
wget https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/raw/nfs-subdir-external-provisioner-4.0.18/deploy/class.yaml
# 1、修改镜像(默认谷歌k8s.gcr.io)
sed -i 's/registry.k8s.io\/sig-storage/dyrnq/g' deployment.yaml
# 2、修改nfs服务端地址
sed -i 's/10.3.243.101/192.168.1.200/g' deployment.yaml
# 3、修改存储地址(/data/k8s)
sed -i 's#\/ifs\/kubernetes#\/data\/k8s#g' deployment.yaml
sed -i 's#nfs-client#nfs-storage#g' class.yaml
sed -i 's/namespace: default/namespace: nfs-storage/g' rbac.yaml deployment.yaml
使用这个镜像:dyrnq/nfs-subdir-external-provisioner:v4.0.2
dockerhub 地址:https://hub.docker.com/r/dyrnq/nfs-subdir-external-provisioner/tags
kubectl create ns nfs-storage
kubectl -n nfs-storage apply -f .
kubectl get pods -n nfs-storage -l app=nfs-client-provisioner
kubectl get storageclass
更多推荐
已为社区贡献8条内容
所有评论(0)