GlusterFS与Kubernetes的适配

  1. 安装epel源
pssh -l auto -h /opt/node.list -i 'sudo yum install -y epel-release*'
  1. 安装heketi
pssh -l auto -h /opt/node.list -i 'sudo yum -y --enablerepo=epel install heketi heketi-client'
  1. 创建块设备文件
pssh -l auto -h /opt/node.list -h 'dd if=/dev/zero of=/opt/gfs_data/common bs=11MB count=1024'
  1. 将块设备文件注册为块设备:
losetup /dev/loop0 /opt/gfs_data/common
如果有报错,则可能需要加载相应的内核模块:
sudo modprobe dm_thin_pool
然后删除刚刚注册了一半的块设备:
sudo losetup -d /dev/loop0
最后再重新注册一遍:
sudo losetup /dev/loop0 /opt/gfs_data/common

  1. 生成相关的服务,保证每次启动的时候都可以自动注册:
[Unit]
Description=Create the loopback device for GlusterFS
DefaultDependencies=false
Before=local-fs.target
After=systemd-udev-settle.service
Requires=systemd-udev-settle.service

[Service] Type=oneshot ExecStart=/usr/bin/bash -c "modprobe dm_thin_pool && [ -b /dev/loop0 ] || losetup /dev/loop0 /home/core/glusterimage"
[Install] WantedBy=local-fs.target
  1. enable服务:
systemctl enable /etc/systemd/system/loopback_gluster.service.
This entry was posted in Glusterfs, Kubernetes and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *