安装Glusterfs

初始化

  • 安装好的 Kubernetes 集群,其中三个节点应各挂载一块空间不小于 500G 的 SSD 磁盘

  • 将准备好的磁盘格式化并挂载到指定目录,需要在所有作为glusterfs master节点执行

# 查看可用磁盘
fdisk -l
# 分区并格式化
mkfs.xfs  /dev/vdb
mkdir  -p /data
echo "/dev/vdb  /data  xfs  defaults 1 2" >>/etc/fstab
# 挂载
mount -a
# 确定/data挂载
df -h | grep data
  • 在 Kubernetes 所有节点安装对应版本的 Glusterfs 客户端工具并加载所需内核模块
# debian 系
apt install software-properties-common
add-apt-repository ppa:gluster/glusterfs-7
apt update
apt install glusterfs-client -y
modprobe dm_thin_pool
apt-get -y install glusterfs-server

systemctl stop glusterd
systemctl disable glusterd

#centos 系
yum -y install centos-release-gluster 
yum -y install glusterfs-server 
systemctl stop glusterd
systemctl disable glusterd


# kylin os
yum -y install glusterfs
systemctl stop glusterd
systemctl disable glusterd

设置glusterfs标签

#设置标签,将 Glusterfs1/2/3 更改为对应的 Kubernetes node 节点IP
kubectl label node Glusterfs1 Glusterfs2 Glusterfs3 storagenode=glusterfs

glusterfs节点不允许调度

kubectl taint node Glusterfs1 Glusterfs2 Glusterfs3 glusterfs=true:NoSchedule

创建glusterfs服务

# ARM
git clone https://gitee.com/JokerPom/gfs-k8s-arm.git cd gfs-k8s-arm
# x86
git clone https://gitee.com/liu_shuai2573/gfs-k8s.git && cd gfs-k8s

检查 Glusterfs 服务是否在指定节点正常运行

kubectl get pods -o wide --selector=glusterfs-node=daemonset
  NAME              READY   STATUS    RESTARTS   AGE    IP              NODE            NOMINATED NODE   READINESS GATES
  glusterfs-2k5rm   1/1     Running   0          52m    192.168.2.200   192.168.2.200   <none>           <none>
  glusterfs-mc6pg   1/1     Running   0          134m   192.168.2.22    192.168.2.22    <none>           <none>
  glusterfs-tgsn7   1/1     Running   0          134m   192.168.2.224   192.168.2.224   <none>           <none>

添加集群

#通过其中一个 Glusterfs 服务将其他两个 Glusterfs 服务加入集群
kubectl exec -ti glusterfs-2k5rm gluster peer probe Glusterfs2_IP
kubectl exec -ti glusterfs-2k5rm gluster peer probe Glusterfs3_IP
#检测是否添加成功,添加成功会显示其他两个 Glusterfs 服务的状态
kubectl exec -ti glusterfs-2k5rm gluster peer status

配置 Glusterfs 集群为 Kubernetes 的可使用资源

#创建服务账户并进行 RBAC 授权
kubectl create -f rbac.yaml
#创建 Glusterfs-provisioner
kubectl create -f deployment.yaml
#  创建storageclass资源, 需要修改 storageclass.yaml 中的 parameters.brickrootPaths 的值,替换为 Glusterfs 节点的IP
kubectl create -f storageclass.yaml

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值