1、确保每台机器上有docker
http://get.daocloud.io/#install-docker
2、关闭 每台机器上的swap,selinux
swapoff -a setenforce 0 sed -i 's/^SELINUX=enforcing$/SELINUX=disable/' /etc/selinux/config
3、注释swap的挂载
vi /etc/fstab #/dev/mapper/centos-swap swap swap defaults 0 0
4、配置k8s的路由参数
cat <<EOF > /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF
5、载入配置
sysctl --system
6、部署k8s阿里云源
cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg EOF yum update
master节点
1、查看可以安装的版本
yum list kubeadm --showduplicates | sort -r
2、安装并启动
此时启动的kubelet状态为失败,集群初始化后正常
yum install -y kubelet-1.20.1-0 kubeadm-1.20.1-0 kubectl-1.20.1-0 --disableexcludes=kubernetes systemctl start kubelet systemctl enable kubelet
kubeadm init --kubernetes-version=1.20.6 --apiserver-advertise-address=192.168.108.19 --image-repository registry.aliyuncs.com/google_containers --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=SystemVerification
标签:centos,kubernetes,--,etc,yum,swap,k8s,安装 From: https://www.cnblogs.com/path602/p/16996718.html