Dok Docs
Github Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

pre-check

概述

DOK 在创建集群之前,会先检查节点是否符合安装集群的最低要求,主要的检查可以参考下面的脚本。

检查Docker

# 检查Docker
command -v dockerd &> /dev/null && echo "docker exists, please remove it" || :

检查是否关闭swap

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

检查Kubernetes依赖

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

检查Linux发行版

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的版本

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