kubernetes官方网站:

Installing kubeadm | Kubernetes


一、Unable to pick a default driver

执行minikube start命令是报如下错误:

Exiting due to DRV_NOT_DETECTED: No possible driver was detected. Try specifying --driver, or see https://minikube.sigs.k8s.io/docs/start/

解决方法:安装docker

#使用官方安装脚本自动安装docker:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

与此同时将当前用户加入docker组;

#安装docker后将当前用户加入docker组:
具体操作可参考:
sudo groupadd docker
sudo gpasswd -a $USER docker
newgrp docker
docker version

 具体截图如下图所示:

重新执行minikube start命令:

设置virtualBox,给ubuntu分配2个cpu;具体如下图所示:

重新执行minikube start命令:

二、 Failed to connect to packages.cloud.google.com port 443: Connection timed out

根据官网知识,按照以下命令:下载安装Google Cloud public signing key的时候:Download the Google Cloud public signing key:

sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

具体截图如下:

尝试解决方法1:失败

手动下载https://packages.cloud.google.com/apt/doc/apt-key.gpg,将下载后的apt-key.gpg复制到/usr/share/keyrings/kubernetes-archive-keyring.gpg文件下;

sudo cp /home/yundong/Downloads/apt-key.gpg  /usr/share/keyrings/kubernetes-archive-keyring.gpg

 继续执行官方文档命令,报如下错误:Unable to locate package kubelet/kubeadm/kubectl;

 尝试解决方法二:

修改download server为国内的mirrors.aliyun.com,然后reload结;具体操作如下:

重新执行sudo apt update命令:

这个是因为官方镜像地址需要能访问国外网的,没有翻墙,国内是连接不上的,所以:

修改为国内的镜像地址:

echo “deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main” | sudo tee /etc/apt/sources.list.d/kubernetes.list

结果如下图所示:

仔细检查才发现,官方指导的“”是中文的,于是修改为英文"",再次尝试如下:

echo "deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

报如下错误:
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
Reading package lists... Done
W: GPG error: https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
E: The repository 'https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial InRelease' is not signed.

 三、使用阿里云源的Public Key的问题

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB

解决方法:

执行以下命令,给阿里云源添加key:

cat /usr/share/keyrings/kubernetes-archive-keyring.gpg |  sudo apt-key add -

 具体操作和结果如下图所示:

最后,按照官方文档,执行如下命令:

sudo apt update
sudo apt install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

最终结果如下图所示:

四、安装kubeadm步骤总结

 第一步:Update the apt package index and install packages needed to use the Kubernetes apt repository

sudo apt update && sudo apt install -y apt-transport-https ca-certificates curl

第二步:Download the Google Cloud public signing key:

#浏览器访问改地址,手动下载pt-key.gpg
https://packages.cloud.google.com/apt/doc/apt-key.gpg
#cp
sudo cp /home/yundong/Downloads/apt-key.gpg  /usr/share/keyrings/kubernetes-archive-keyring.gpg

第三步:Add the Kubernetes apt repository:

echo “deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main” | sudo tee /etc/apt/sources.list.d/kubernetes.list

第四步:给阿里云源添加public key

cat /usr/share/keyrings/kubernetes-archive-keyring.gpg |  sudo apt-key add -

第五步:Update apt package index, install kubelet, kubeadm and kubectl, and pin their version

sudo apt update
sudo apt install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

Logo

开源、云原生的融合云平台

更多推荐