Skip to content

Instantly share code, notes, and snippets.

@saidimu
Forked from jbeda/update-centos-7.sh
Created April 28, 2017 19:14
Show Gist options
  • Save saidimu/d0a1dff8dbfa34eee9ca939974c17acb to your computer and use it in GitHub Desktop.
Save saidimu/d0a1dff8dbfa34eee9ca939974c17acb 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment