无法在VM上的CentOS 7上按照官方安装指南安装Kubernetes最新版本

时间:2018-07-31 14:07:30

标签: kubernetes centos7

当我执行以下命令(取自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

2 个答案:

答案 0 :(得分:1)

您似乎在第一行末尾缺少erase_remove_if

此外,我看到docs中有一个错误

包含<<EOF的行应被删除。

应如下所示:

exclude=kube*

答案 1 :(得分:1)

kubernetes.repo 中删除以下行后,它对我有用:

exclude = kubelet kubeadm kubectl