Ubuntu安装K8S
第一步: 安装docker
Install Docker
#注意docker是早期的名称已经过时了,因此请使用如下命令,一步到位安装docker-ce。
第二步:设置K8S源: (大陆使用aliyun源,大陆外使用google源)
vim打开 /etc/apt/sources.list 文件,添加一行
deb https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial main
再次执行安装 K8s 的命令。
如果出现
The following signatures couldn’t be verified because the public key is not available
则执行下面命令,为期添加 key。
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add
源设置好之后执行:
apt-get install -y kubelet kubeadm kubectl --allow-unauthenticated
systemctl restart kubelet && systemctl enable kubelet
systemctl daemon-reload
##查看K8S运行所需Pods镜像,至此K8S运行软件就装好了
kubeadm config images list
##下载Pods镜像并初始化K8S
kubeadm init
(kubeadm init --image-repository=registry.aliyuncs.com/google_containers)大陆要加上阿里云源指定pods运行镜像下载来源,否则会超时
或者依次下载K8S镜像:
docker pull registry.aliyuncs.com/google_containers/kube-apiserver:v1.28.2
docker pull registry.aliyuncs.com/google_containers/kube-controller-manager:v1.28.2
docker pull registry.aliyuncs.com/google_containers/kube-scheduler:v1.28.2
docker pull registry.aliyuncs.com/google_containers/kube-proxy:v1.28.2
docker pull registry.aliyuncs.com/google_containers/pause:3.9
docker pull registry.aliyuncs.com/google_containers/etcd:3.5.9-0
docker pull registry.aliyuncs.com/google_containers/coredns:v1.10.1