Kubernetes-k8s安装教程技术详解

资讯 3年前
1.04K

Kubernetes安装具体步骤

所有服务器节点安装 Docker/kubeadm/kubelet/kubectl

Kubernetes 默认容器运行环境是Docker,因此首先需要安装Docker;

(1)安装 Docker

更新docker的yum源

yum install wget -y

wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo

安装指定版本的docker:

yum install docker-ce-19.03.13 -y

yum install docker -y (这个安装的Docker版本偏旧) 1.13.x

配置加速器加速下载 (https://cr.console.aliyun.com/)

/etc/docker/daemon.json

"registry-mirrors": ["https://registry.docker-cn.com"]

https://gg3gwnry.mirror.aliyuncs.com

然后执行:

systemctl enable docker.service

不然会提示警告;

那么接下来需要搭建:kubeadm、kubelet、kubectl

添加k8s的阿里云YUM源

cat > /etc/yum.repos.d/kubernetes.repo << EOF

[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.gpg

EOF

到时候下载k8s的相关组件才能找到下载源;

(2)安装 kubeadm,kubelet 和 kubectl

yum install kubelet-1.19.4 kubeadm-1.19.4 kubectl-1.19.4 -y

然后执行:

systemctl enable kubelet.service

不然会提示警告;

查看有没有安装:

yum list installed | grep kubelet

yum list installed | grep kubeadm

yum list installed | grep kubectl

© 版权声明

相关文章