关闭防火墙:systemctl disable firewalld #永久关闭
关闭selinux:sed -i ‘s/enforcing/disabled’ /etc/selinux/config
关闭swap:sed -ri ‘s/.swap./#&/’ /etc/fstab
设置hostname:hostnamectl set-hostname k8smaster
在master添加hosts:`
cat >> /etc/hosts << EOF
192.168.3.215 k8smaster
192.168.163.142 k8snode1
192.168.163.143 k8snode2
EOF
`
将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.window.com
#安装docker
- wget http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
- yum -y install docker-ce-18.06.1.ce-3.el7
- systemctl enable docker && systemctl start docker
- systemctl restart docker.service #重启docker服务
#初始化
kubeadm init --kubernetes-version=1.18.0 --apiserver-advertise-address=192.168.163.147 --image-repository registry.aliyuncs.com/google_containers --service-cidr=10.96.0.0/12 --pod-network-cidr=10.244.0.0/16