Centos7安装kubernetes
环境:
奇数台设备(虚拟机或服务器)
最低配置:2 core,4GB
初始操作
- 关闭防火墙
systemctl stop firewalld systemctl disable firewalld
- 关闭selinux
sed -i 's/enforcing/disabled/' /etc/selinux/config
- 关闭swap,并重启
swapoff -a # 临时 sed -ri 's/.*swap.*/#&/' /etc/fstab # 永久
- 根据规则设置主机名
hostnamectl set-hostname <hostname>
- 在master节点添加hosts
cat >> /etc/hosts << EOF 192.168.59.130 k8s-master 192.168.59.131 k8s-node1 192.168.59.132 k8s-node2
- 将桥接的IPv4流量传递到iptables
cat > /etc/sysctl.d/k8s.conf << EOF net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF # 生效 sysctl --system
- 时间同步
yum install ntpdate -y ntpdate time.windows.com