标签:ons 控制器 rbac 格式化 parameter 创建 fdisk visio ubuntu
# ubuntu16.04
add-apt-repository ppa:gluster/glusterfs-7
apt-get update
apt-get install glusterfs-client -d
modprobe dm_thin_pool
# centos
yum -y install centos-release-gluster
yum -y install glusterfs-client
modprobe dm_thin_pool
# 查看可用磁盘
fdisk -l
# 分区并格式化
mkfs.xfs /dev/vdb1
mkdir -p /data
echo "/dev/vdb1 /data xfs defaults 1 2" >>/etc/fstab
# 挂载
mount -a
# 确定/data挂载
df -h | grep data
以下操作在k8s的任一master节点执行
git clone https://gitee.com/liu_shuai2573/gfs-k8s.git && cd gfs-k8s
#设置标签,调度glusterfs的pod至指定节点
kubectl label node 10.10.10.71 10.10.10.72 10.10.10.73 storagenode=glusterfs
#设置taint策略,使该节点只运行glusterfs,如需复用glusterfs节点请忽略该操作
kubectl taint node 10.10.10.71 10.10.10.72 10.10.10.73 glusterfs=true:NoSchedule
#设置taint策略,使该节点只运行rbd-gateway,如需复用rbd-gateway节点请忽略该操作
kubectl taint node 10.10.10.86 10.10.10.87 rbd-gateway=true:NoSchedule
kubectl create -f gluster-daemonset.yaml
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>
kubectl exec -ti glusterfs-2k5rm gluster peer probe 192.168.2.22
kubectl exec -ti glusterfs-2k5rm gluster peer probe 192.168.2.224
# 检测是否添加成功
kubectl exec -ti glusterfs-2k5rm gluster peer status
kubectl create -f rbac.yaml
kubectl create -f deployment.yaml
创建storageclass资源
修改storageclass.yaml
文件中的parameters.brickrootPaths
字段对应的值,将gfs的pod IP替换掉
kubectl create -f storageclass.yaml
创建成功时STATUS为Bound
kubectl create -f pvc.yaml
kubectl get pvc | grep gluster-simple-claim
运行正常时STATUS为Running
kubectl create -f pod.yaml
kubectl get po | grep gluster-simple-pod
Kubernetes之GlusterFS集群文件系统高可用安装
标签:ons 控制器 rbac 格式化 parameter 创建 fdisk visio ubuntu
原文地址:https://www.cnblogs.com/Aaron-23/p/13130331.html