Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

install a specific version of kubernetes on centos

I installed kubernetes using these commands on centos7

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$basearch
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

This will install the latest version, so i'm looking for a method to install a specific version. for example 1.8.1

Thank you

like image 689
kikas Avatar asked Apr 12 '18 10:04

kikas


People also ask

Which command is used to get the Kubernetes version?

The simplest way of checking a cluster's Kubernetes version is to use the kubectl version command. This command will output information for the kubectl client and the Kubernetes cluster. The Server Version is the version of Kubernetes your cluster is running.

What is the difference between Kubeadm and kubectl?

kubeadm: the command to bootstrap the cluster. kubelet: the component that runs on all of the machines in your cluster and does things like starting PODs and containers. kubectl: the command line until to talk to your cluster.


Video Answer


2 Answers

To install a specific version of the package it is enough to define it during the yum install command:

yum install -y kubelet-<version> kubectl-<version> kubeadm-<version>

But for your particular case, when you want to install kubernetes version 1.8.1, kubernetes-cni package should be 0.5.1 version to satisfy dependency requirements:

--> Finished Dependency Resolution
Error: Package: kubelet-1.8.1-1.x86_64 (kubernetes)
           Requires: kubernetes-cni = 0.5.1
           Available: kubernetes-cni-0.3.0.1-0.07a8a2.x86_64 (kubernetes)
               kubernetes-cni = 0.3.0.1-0.07a8a2
           Available: kubernetes-cni-0.5.1-0.x86_64 (kubernetes)
               kubernetes-cni = 0.5.1-0
           Available: kubernetes-cni-0.5.1-1.x86_64 (kubernetes)
               kubernetes-cni = 0.5.1-1
           Installing: kubernetes-cni-0.6.0-0.x86_64 (kubernetes)
               kubernetes-cni = 0.6.0-0

So, the final command is:

yum install -y kubelet-1.8.1 kubectl-1.8.1 kubeadm-1.8.1 kubernetes-cni-0.5.1
like image 58
nickgryg Avatar answered Oct 22 '22 01:10

nickgryg


Kubernetes cluster can be ready to use in minutes, and it does not depend much on rpm/deb packages delivered by operating system vendors.

Packages are delivered for user's comfort and consistency of installation. Usually, it is possible to downgrade packages provided by CentOS without breaking dependencies, but you need to be careful.

Kubernetes includes the kubeadm tool, which can setup all dependencies and spin up cluster in version provided in the command line:

sudo kubeadm init --kubernetes-version=v1.9.2  

The installation process of a specific version is described in installation manual. I've also used scripts.

To avoid compatibility problem, please make sure your Kubernetes version is compatible with Docker containers engine version.

like image 32
d0bry Avatar answered Oct 22 '22 00:10

d0bry