Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for installing Kubernetes 1.8.4 #311

Merged
merged 2 commits into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ If you need to remove Contiv from Docker Swarm and return to your original state

### Prerequisites

* Kubernetes 1.4.x, 1.5.x and 1.6.2+ are supported with the following instructions.
* Kubernetes 1.4.x, 1.5.x, 1.6.2+, and 1.8.4+ are supported with the following instructions.
* CentOS 7.x operating system
* Install Kubernetes:
1. kubeadm installs the latest Kubernetes version. <br>
For Kubernetes 1.4, see an example script [here.](https://github.com/contiv/install/blob/master/cluster/k8s1.4/k8smaster.sh)
For Kubernetes 1.6, see an example script [here.](https://github.com/contiv/install/blob/master/cluster/k8s1.6/k8smaster.sh)
For Kubernetes 1.8, see an example script [here.](https://github.com/contiv/install/blob/master/cluster/k8s1.8/k8smaster.sh)
1. Replace step (3/4) in the kubeadm install guide with the following Contiv Installation Instructions. Contiv installation can be done after completing step (4/4).
1. Instructions to install Kubernetes are available [here.](http://kubernetes.io/docs/getting-started-guides/kubeadm/)
1. **Kubernetes 1.4 NOTE:** A recent kubeadm update has rendered the latest kubeadm unable to install Kubernetes 1.4. To workaround this issue, please use kubeadm version 1.6.0-0.alpha or earlier.
Expand Down
3 changes: 2 additions & 1 deletion cluster/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require 'rubygems'
require 'fileutils'
require 'yaml'

DEFAULT_K8S_VERSION = 'v1.6.5'.freeze
DEFAULT_K8S_VERSION = 'v1.8.4'.freeze

# Guest OS versions for testing
UBUNTU = 'ubuntu'.freeze
Expand Down Expand Up @@ -32,6 +32,7 @@ k8s_ver = ENV['CONTIV_K8S_VERSION'] || DEFAULT_K8S_VERSION
orc_path = case k8s_ver
when /^v1\.[45]\./ then 'k8s1.4/'
when /^v1\.[67]\./ then 'k8s1.6/'
when /^v1\.[8]\./ then 'k8s1.8/'
else
raise "unsupported k8s version: #{k8s_ver}"
end
Expand Down
40 changes: 40 additions & 0 deletions cluster/k8s1.8/bootstrap_centos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

set -euo pipefail

if [ $EUID -ne 0 ]; then
echo "Please run this script as root user"
exit 1
fi

cat <<EOF >/etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
EOF

setenforce 0

swapoff -a

yum install -y docker kubelet-1.8.4 kubeadm-1.8.4 kubectl-1.8.4 kubernetes-cni-1.8.4 ntp

systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet
systemctl enable ntpd && systemctl start ntpd

if systemctl -q is-active firewalld; then
systemctl stop firewalld
fi
if systemctl -q is-enabled firewalld; then
systemctl disable firewalld
fi

systemctl stop ntpd
ntpdate 1.ntp.esl.cisco.com || ntpdate pool.ntp.org
systemctl start ntpd

exit 0
30 changes: 30 additions & 0 deletions cluster/k8s1.8/bootstrap_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -euo pipefail

if [ $EUID -ne 0 ]; then
echo "Please run this script as root user"
exit 1
fi

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
# Install docker if you don't have it already.
apt-get install -y docker.io
apt-get install -y kubelet kubeadm kubectl kubernetes-cni
apt-get install -y ntp

systemctl enable ntpd && systemctl start ntpd
systemctl -q is-active firewalld && systemctl stop firewalld || true
systemctl -q is-enabled firewalld && systemctl disable firewalld || true

if systemctl -q is-active firewalld; then
systemctl stop firewalld
fi
if systemctl -q is-enabled firewalld; then
systemctl disable firewalld
fi
7 changes: 7 additions & 0 deletions cluster/k8s1.8/k8smaster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kubeadm init --token=$1 --apiserver-advertise-address=$2 --skip-preflight-checks=true --kubernetes-version $3
if [ "$#" -eq 4 ]; then
cp /etc/kubernetes/admin.conf /home/$4
chown $(id -u $4):$(id -g $4) /home/$4/admin.conf
echo "export KUBECONFIG=/home/$4/admin.conf" >> /home/$4/.$(basename $SHELL)rc
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.$(basename $SHELL)rc
fi
1 change: 1 addition & 0 deletions cluster/k8s1.8/k8sworker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kubeadm join --token=$1 --skip-preflight-checks=true $2:6443
2 changes: 1 addition & 1 deletion install/k8s/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ k8sversion=$($kubectl version --short | grep "Server Version")
if [[ "$k8sversion" == *"v1.4"* ]] || [[ "$k8sversion" == *"v1.5"* ]]; then
k8sfolder="k8s1.4"
else
k8sfolder="k8s1.6"
k8sfolder="rbac"
fi

#
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion install/k8s/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ k8sversion=$($kubectl version --short | grep "Server Version")
if [[ "$k8sversion" == *"v1.4"* ]] || [[ "$k8sversion" == *"v1.5"* ]]; then
k8sfolder="k8s1.4"
else
k8sfolder="k8s1.6"
k8sfolder="rbac"
fi
if [ "$#" -eq 1 ] && [ "$1" = "-h" ]; then
echo "Usage: ./install/k8s/uninstall.sh to uninstall contiv"
Expand Down