Gluster-Heketi-Kubernetes 安装步骤
参考文档:https://github.com/gluster/gluster-kubernetes
实验环境:
Kubernetes:v1.12.1
Glusterfs: 3.7.6
OS: Ubuntu 16.04
Docker:18.6.1
详细情况如下图所示:
要求:
- 安装Glusterfs客户端:每个gluster集群的节点需要安装gulsterfs的客户端,如ubuntu系统的sudo apt-get install glusterfs-client。本案例中,需要在master, worker3,worker4上运行sudo apt-get install glusterfs-client。
- 加载内核模块:每个gluster集群的节点加载内核模块dm_thin_pool,dm_mirror,dm_snapshot。本案例中,需要在master, worker3,worker4上运行,执行语句:sudo modprobe dm_thin_pool && sudo modprobe dm_mirror &&sudo modprobe dm_snapshot。
- 至少三个gluster节点:至少需要3个节点用来部署glusterfs集群,并且这3个slave节点每个节点需要至少一个空余的磁盘。本案例中加入的磁盘如下:master: 192.168.0.50 磁盘:/dev/sdb;磁盘:/dev/sdc;worker3:;192.168.0.53 磁盘:/dev/sdc ;worker4: 192.168.0.54 磁盘:/dev/sdg
主要步骤:
- 在master节点,下载gluster-kubernetes, 运行git clone https://github.com/gluster/gluster-kubernetes.git,该项目提供了自动化安装工具和各种模板。
- 进入文件夹,cd gluster-kubernetes/deploy
-
执行 vim kube-templates/glusterfs-daemonset.yaml,修改kube-templates/glusterfs-daemonset.yaml内容,改变了pod存活检查和读取检查部分内容,如下:
注释了- "if command -v /usr/local/bin/status-probe.sh; then /usr/local/bin/status-probe.sh readiness; else systemctl status glusterd.service; fi"
添加:
- "systemctl status glusterd.service"
如下图所示:
- 管理员必须提供GlusterFS集群拓扑信息。这是一个拓扑文件的形式,它描述了在GlusterFS集群中存在的节点,以及连接在它们上的块设备,以供heketi使用。我们创建的my-topology.json, 执行vim my-topology.json:
-
文件代码:
{ "clusters": [ { "nodes": [ { "node": { "hostnames": { "manage": [ "master" ], "storage": [ "192.168.0.50" ] }, "zone": 1 }, "devices": [ "/dev/sdb" ] }, { "node": { "hostnames": { "manage": [ "worker3" ], "storage": [ "192.168.0.53" ] }, "zone": 1 }, "devices": [ "/dev/sdc" ] }, { "node": { "hostnames": { "manage": [ "worker4" ], "storage": [ "192.168.0.54" ] }, "zone": 1 }, "devices": [ "/dev/sdg" ] } ] } ] }
根据集群磁盘配置情况,修改此my-topology.json,需要修改manage、storage、devices内容。其中manage:节点名;storage:节点IP;devices: 磁盘名。
-
执行 gk-deploy –g my-topology.json