Skip to content

Instantly share code, notes, and snippets.

@jbeda
Last active February 9, 2022 11:50
Show Gist options
  • Save jbeda/5e8a4ce0a23711da146e51900859c037 to your computer and use it in GitHub Desktop.
Save jbeda/5e8a4ce0a23711da146e51900859c037 to your computer and use it in GitHub Desktop.
Install prev kubeadm versions
kubeadm init --use-kubernetes-version=v1.5.6
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/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
# 1.5.4 is the latest previous version in the repo. Because of messed up
# versioning in the 1.5 release, kubeadm is no longer indexed in the repos
# so we have to refer to the RPM directly.
sudo yum -y install \
yum-versionlock \
docker \
kubectl-1.5.4-0 \
kubelet-1.5.4-0 \
kubernetes-cni-0.3.0.1-0.07a8a2 \
http://yum.kubernetes.io/pool/082436e6e6cad1852864438b8f98ee6fa3b86b597554720b631876db39b8ef04-kubeadm-1.6.0-0.alpha.0.2074.a092d8e0f95f52.x86_64.rpm
# Lock the version of these packages so that we don't upgrade them accidentally.
sudo yum versionlock add kubectl kubelet kubernetes-cni kubeadm
# Enable and start up docker and the kubelet
systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet
apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
# 1.5.6 does exist in the repo but it has a hard depenedency on a newer kubernetes-cni. Use 1.5.3 instead.
sudo apt-get -y install kubectl=1.5.3-00 kubelet=1.5.3-00 kubernetes-cni=0.3.0.1-07a8a2-00
# Versioning strangeness for how we packaged kubeadm pre-1.6 means that the version number
# says 1.6.0-alpha even though it is the 1.5 version of kubeadm. Because of how this sorts,
# we cannot keep this deb in the repo. Download it manually and install it.
curl -Lo /tmp/old-kubeadm.deb https://apt.k8s.io/pool/kubeadm_1.6.0-alpha.0.2074-a092d8e0f95f52-00_amd64_0206dba536f698b5777c7d210444a8ace18f48e045ab78687327631c6c694f42.deb
sudo dpkg -i /tmp/old-kubeadm.deb
sudo apt-get install -f
# Hold these packages back so that we don't accidentally upgrade them.
sudo apt-mark hold kubeadm kubectl kubelet kubernetes-cni
@luxas
Copy link

luxas commented Apr 6, 2017

LGTM 👍, feel free to add this to the reference guide on the site

@miticojo
Copy link

instead of use direct url of rpm, you can install dnf and the install kubeadm-1.x.x ...this will install all dependencies needed

@alexkonkin
Copy link

Thank you so much,
only with your sh script I've managed to install kubernetes on Ubuntu 16.04, the current version of k8s is 1.9 and
I was not able to got it working (corrention refused error)

@geminivivek
Copy link

Thank You, It is still relevent and helped me save time . This information was very hard to find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment