准备条件 虚拟机、安装centos、安装docker
curl -fsSL get.docker.com -o get-docker.sh vi get-docker.sh sh get-docker.sh --mirror Aliyun systemctl daemon-reload
启动、重启 关闭
systemctl start docker systemctl restart docker systemctl stop docker
设置配置文件 跟阿里镜像仓库
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
配置跟安装
setenforce 0 # 将 SELinux 设置为 permissive 模式(相当于将其禁用) sudo setenforce 0 sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
启动
sudo systemctl enable --now kubelet 重启 systemctl restart kubelet