pre-check
Before creating a cluster, DOK will first check whether the nodes meet the minimum requirements for installing a cluster. For the main checks, please refer to the script below.
# 检查Docker
command -v dockerd &> /dev/null && echo "docker exists, please remove it" || :
DISABLE_SWQP=$(cat /proc/swaps|wc -l)
if [ "$DISABLE_SWQP" -gt 1 ]; then echo "swap haven't been turn off" && exit 1; fi
if [ ! -d /data ]; then echo "there is no /data dir in the host" && exit 1; fi
DATA_DISK_SIZE=$(df -PhBG /data | tail -1 | awk '{print $4}'|sed "s/G//")
if [ $DATA_DISK_SIZE -lt 200 ]; then echo "the free size of disk mount by /data is less than 200G" && exit 1; fi
K8S_RELATED_EXIST=$(rpm -qa|grep -i kube|wc -l)
if [ "$K8S_RELATED_EXIST" != 0 ]; then echo "k8s related rpm exists, please remove it" && exit 1; fi
DISTRIBUTION=$(grep '^ID=' /etc/os-release | awk -F "=" '{print $2}' | sed 's/\"//g')
if [ "$DISTRIBUTION" != "centos" ]; then echo "distribution is $DISTRIBUTION but not centos" && exit 1; fi
CENTOS_VERSION=$(grep '^VERSION_ID=' /etc/os-release | awk -F "=" '{print $2}' | sed 's/\"//g')
if [ "$CENTOS_VERSION" -ne 7 ]; then echo "centos version is $CENTOS_VERSION but not 7" && exit 1; fi
KERNEL_VERSION=$(uname -r)
if [ "$KERNEL_VERSION" != "5.4.127-1.el7.elrepo.x86_64" ]; then echo "kernel version is $KERNEL_VERSION but not 5.4.127-1.el7.elrepo.x86_64" && exit 1; fi