昨天搭建k8s集群环境时,安装报错,显示无法找到。

1、打开vim /etc/apt/sources.list,写入阿里云的源

deb https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial main

2、将阿里云的gpg写入 ,(#更新证书 curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add,报错,ubuntu 20.4版本不支持apt-key add)

curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg |  gpg --dearmor > /usr/share/keyrings/EXAMPLE.gpg
echo "deb [signed-by=/usr/share/keyrings/EXAMPLE.gpg] https://mirrors.aliyun.com/kubernetes/apt stable main" || sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

3、更新 

sudo apt-get update

4、安装kubeadm ,报错

kubeadm : Depends: kubernetes-cni (= 0.6.0)
 kubelet : Depends: kubernetes-cni (= 0.6.0)

 5、解决报错,安装apt-get install kubernetes-cni=0.6.0-00

6、再次安装,成功

 

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐