kubeadm离线部署k8s之系统初始化
kubeadm离线部署k8s之系统初始化将yum包下载到本地配置本地yum,用于解决包依赖问题各节点相互解析和更改主机名(所有节点)hostnamectl set-hostnamemastervim /etc/hosts10.184.33.78master10.184.33.66node1安装依赖包(所有节点)yum-yinstall ntpdatent...
kubeadm离线部署k8s之系统初始化
将yum包下载到本地
配置本地yum,用于解决包依赖问题
各节点相互解析和更改主机名(所有节点)
hostnamectl set-hostname master
vim /etc/hosts
192.168.111.111 master
192.168.111.112 node1
安装依赖包(所有节点)
yum -y install ntpdate ntp conntrack ipvsadm iptables ipset jq curl sysstat libseccomp wget vim net-tools git vim
由于制作了本地yum源,大部分依赖都解决了,只剩下conntrack和jq没安装,在有网的机器上手动下载,然后迁移到本机
去这两个目录下找rpm包
yum可以直接解决报的依赖关系
yum -y install conntrack-tools-1.4.4-5.el7_7.2.x86_64.rpm libnetfilter_cttimeout-1.0.0-6.el7_7.1.x86_64.rpm libnetfilter_cthelper-1.0.0-10.el7_7.1.x86_64.rpm libnetfilter_queue-1.0.2-2.el7_2.x86_64.rpm
Jq 用源码编译安装的
好像是需要一个bison,要3.0左右的版本 bison下载网址
tar xf bison-3.0.tar.gz cd bison-3.0
./configure && make && make install
依赖gcc,yum可以解决 yum -y install gcc 安装
jq下载地址
cd jq-1.5
./configure && make && make install
源码编译的jq(机器不承认我装了jq,但能用)
关闭firstwalld、selinux(所有节点)
systemctl stop firewalld && systemctl disable firewalld
setenforce 0 && sed -ir 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
设置防火墙iptables并清空规则(所有节点)
yum -y install iptables-services
systemctl start iptables && systemctl enable iptables && iptables -F && service iptables save
调整内核参数(所有节点)
cat > kubernetes.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.ipv4.tcp_tw_recycle = 0
vm.swappiness = 0
vm.overcommit_memory= 1
vm.panic_on_oom = 0
fs.inotify.max_user_instances = 8192
fs.inotify.max_user_watches = 1048576
fs.file-max = 52706963
fs.nr_open = 52706963
net.ipv6.conf.all.disable_ipv6 = 1
net.netfilter.nf_conntrack_max = 2310720
EOF
cp kubernetes.conf /etc/sysctl.d/
sysctl -p /etc/sysctl.d/kubernetes.conf
关闭swap分区(所有节点)
sed -i 's/.*swap.*/#&/' /etc/fstab && cat /etc/fstab && swapoff -a && free -m
升级内核
uname -r
rpm -Uvh kernel-lt-4.4.202-1.el7.elrepo.x86_64.rpm
grub2-set-default 0
reboot
更多推荐
所有评论(0)