安装docker
安装命令
yum install docker -y
启动
systemctl enable docker
systemctl start docker
如果启动不成功,通过systemctl status docker命令查看日志
如果启动报这种错
那需要编辑vi /etc/sysconfig/docker,将selinux-enabled设置为false
再次执行sysemctl restart docker,启动成功。
安装 kubelet kubeadm kubectl
安装命令
- 如果机器可以翻墙,则可以直接使用一下命令安装
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
yum install -y kubelet kubeadm kubectl
- 推荐安装(使用阿里镜像安装)
# 配置源
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 install -y kubelet kubeadm kubectl