我正在尝试使用 kubeadm 工具创建一个高可用性集群。我正在尝试安装 kubeadm 安装的先决条件中指定的工具。当我运行 sudo apt-get install -y kubelet kubeadm kubectl 时,我收到如下错误,

Building dependency tree
Reading state information... Done
E: Unable to locate package kubelet
E: Unable to locate package kubeadm
E: Unable to locate package kubectl

我的尝试

我正在按照以下官方文档从 kubernetes.io 准备节点。我指的是以下链接,

https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#before-you-begin

当我按照官方文档中的描述继续执行以下命令时,
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

更新

当我尝试 Mr.Tummala 的答案时,我收到如下错误,
W: Failed to fetch https://apt.kubernetes.io/dists/kubernetes-xenial/InRelease  Could not resolve host: apt.kubernetes.io
W: Some index files failed to download. They have been ignored, or old ones used instead.

但结果如无法找到包裹。

最佳答案

看看下面的步骤是否适合你。

sudo apt-get update && sudo apt-get install -y apt-transport-https curl
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

关于kubernetes - 安装 kubectl kubeadm for kubernetes 安装时无法定位包 kubectl,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59265021/

10-16 08:30