一、卸载旧版本的Docker
# 如果系统没有装过docker可跳过此步骤
[root@localhost luna]$ yum remove docker docker-common container-selinux docker-selinux docker-engine -y
二、安装yum-utils
[root@localhost luna]$ yum install -y yum-utils
三、配置稳定版的docker软件仓库
[root@localhost luna]$ yum-config-manager --add-repo
https://download.docker.com/linux/centos/docker-ce.repo
四、安装Docker
# 执行docker安装命令
[root@localhost luna]$ yum makecache fast && sudo yum install docker-ce -y
[root@localhost luna]$ systemctl start docker # 启动docker服务
[root@localhost luna]$ docker -v #查看版本
五、配置kubernetes yum源
[root@localhost luna]$ 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
六、安装kubelet、kubeadm、kubectl
[root@localhost luna]$ yum install -y kubelet kubeadm kubectl