????????systemctl stop firewalld
????????systemctl disable firewalld
????????sed -i 's/enforcing/disabled/' /etc/selinux/config
????????vim /etc/fstab
????????注释掉swap这行
????????????????# /dev/mapper/centos‐swap swap swap defaults 0 0
????????systemctl reboot ????????
#重启生效
????????free ‐m ????????
#查看下swap交换区是否都为0,如果都为0则swap关闭成功
????????hostnamectl set-hostname k8s-master
????????hostnamectl set-hostname k8s-node1
????????hostnamectl set-hostname k8s-node2
- 给三台机器添加hosts,均执行下面命令,ip换成自己的
????????vim /etc/hosts
????????192.168.121.91 k8s-master
????????192.168.121.82 k8s-node1
????????192.168.121.83 k8s-node2
? ? ? ? 创建vim /etc/sysctl.d/k8s.conf
? ? ? ? 添加
????????net.bridge.bridge-nf-call-ip6tables = 1
????????net.bridge.bridge-nf-call-iptables = 1
????????sysctl --system? ? ? ? #使配置生效
????????yum install ntpdate ‐y
????????ntpdate time.windows.com
????????vim /etc/yum.repos.d/kubernetes.repo
? ? ? ? 添加以下代码
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpgernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
???????yum remove ‐y kubelet kubeadm kubectl
?????????yum list kubelet --showduplicates | sort -r
- 安装kubelet、kubeadm、kubectl指定版本,这里使用kubeadm安装集群
????????yum install -y kubelet-1.18.0 kubeadm-1.18.0 kubectl-1.18.0
????????systemctl enable kubelet
????????systemctl start kubelet