无法按照CentOS 7官方安装指南在虚拟机上安装Kubernetes最新版本

h5qlskok  于 2023-01-25  发布在  Kubernetes
关注(0)|答案(4)|浏览(316)

当我执行以下命令(取自Kubernetes的官方安装指南)时,输出是意外的(如下所示:)命令(在CentOS 7上):

cat < /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg 
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kube*
EOF
setenforce 0
yum install -y kubelet kubeadm kubectl
systemctl enable kubelet && systemctl start kubelet

输出:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

base: centos.sonn.com
extras: mirror.sesp.northwestern.edu
updates: mirrors.cat.pdx.edu
kubernetes/signature | 454 B 00:00:00
kubernetes/signature | 1.4 kB 00:00:00 !!!
kubernetes/primary | 33 kB 00:00:00
kubernetes 237/237
No package kubelet available.
No package kubeadm available.
No package kubectl available.
Error: Nothing to do

您期望发生的情况:
kubeadm、kubeclt和kubelet已安装并启用
如何重现:
在centos 7上运行上述命令(按照https://kubernetes.io/docs/setup/independent/install-kubeadm/上的指南)

Docker version: Client:
Version: 17.03.2-ce
API version: 1.27
Go version: go1.7.5
Git commit: f5ec1e2
Built: Tue Jun 27 02:21:36 2017
OS/Arch: linux/amd64

服务器:

Version: 17.03.2-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: f5ec1e2
Built: Tue Jun 27 02:21:36 2017
OS/Arch: linux/amd64
Experimental: false

环境:
Kubernetes版本(使用kubectl版本):无法按照官方指南安装最新版本。硬件配置:虚拟机按照官方指南(2GB内存和2个CPU)操作系统:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

内核:

Linux k1 3.10.0-862.9.1.el7.x86_64 #1 SMP Mon Jul 16 16:29:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
7kqas0il

7kqas0il1#

您似乎在第一行末尾缺少<<EOF
此外,我可以看到docs中有一个错误
应删除包含exclude=kube*的行。
其内容应如下:

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y kubelet kubeadm kubectl
systemctl enable kubelet && systemctl start kubelet
x0fgdtte

x0fgdtte2#

kubernetes.repo 中删除以下行后,它对我起作用了:
排除=kubelet kubeadm库贝特尔

tkqqtvp1

tkqqtvp13#

sudo cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg 
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
bash: /etc/yum.repos.d/kubernetes.repo: Permission denied

运行这个程序后,我仍然得到一个权限被拒绝的错误,即使我使用sudo,我的用户帐户有管理员权限。我的问题的解决方案是登录我的Rocky Linux作为root用户,并完成安装。

7lrncoxx

7lrncoxx4#

在/etc/ sudo cat〈sudo /etc/yum.repos.d/kubernetes.repo前面使用sudo

相关问题