diff --git a/README.md b/README.md index 2ffdf72..c322b21 100644 --- a/README.md +++ b/README.md @@ -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.
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. diff --git a/cluster/Vagrantfile b/cluster/Vagrantfile index b87a0d3..8384055 100755 --- a/cluster/Vagrantfile +++ b/cluster/Vagrantfile @@ -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 @@ -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 diff --git a/cluster/k8s1.8/bootstrap_centos.sh b/cluster/k8s1.8/bootstrap_centos.sh new file mode 100755 index 0000000..709e424 --- /dev/null +++ b/cluster/k8s1.8/bootstrap_centos.sh @@ -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 </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 diff --git a/cluster/k8s1.8/bootstrap_ubuntu.sh b/cluster/k8s1.8/bootstrap_ubuntu.sh new file mode 100644 index 0000000..08f27d8 --- /dev/null +++ b/cluster/k8s1.8/bootstrap_ubuntu.sh @@ -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 </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 diff --git a/cluster/k8s1.8/k8smaster.sh b/cluster/k8s1.8/k8smaster.sh new file mode 100644 index 0000000..d1a5c96 --- /dev/null +++ b/cluster/k8s1.8/k8smaster.sh @@ -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 \ No newline at end of file diff --git a/cluster/k8s1.8/k8sworker.sh b/cluster/k8s1.8/k8sworker.sh new file mode 100644 index 0000000..569bb0e --- /dev/null +++ b/cluster/k8s1.8/k8sworker.sh @@ -0,0 +1 @@ +kubeadm join --token=$1 --skip-preflight-checks=true $2:6443 diff --git a/install/k8s/install.sh b/install/k8s/install.sh index fce0c58..545397b 100755 --- a/install/k8s/install.sh +++ b/install/k8s/install.sh @@ -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 # diff --git a/install/k8s/k8s1.6/aci_gw.yaml b/install/k8s/rbac/aci_gw.yaml similarity index 100% rename from install/k8s/k8s1.6/aci_gw.yaml rename to install/k8s/rbac/aci_gw.yaml diff --git a/install/k8s/k8s1.6/cleanup.yaml b/install/k8s/rbac/cleanup.yaml similarity index 100% rename from install/k8s/k8s1.6/cleanup.yaml rename to install/k8s/rbac/cleanup.yaml diff --git a/install/k8s/k8s1.6/contiv-grafana.yml b/install/k8s/rbac/contiv-grafana.yml similarity index 100% rename from install/k8s/k8s1.6/contiv-grafana.yml rename to install/k8s/rbac/contiv-grafana.yml diff --git a/install/k8s/k8s1.6/contiv-prometheus.yml b/install/k8s/rbac/contiv-prometheus.yml similarity index 100% rename from install/k8s/k8s1.6/contiv-prometheus.yml rename to install/k8s/rbac/contiv-prometheus.yml diff --git a/install/k8s/k8s1.6/contiv.yaml b/install/k8s/rbac/contiv.yaml similarity index 100% rename from install/k8s/k8s1.6/contiv.yaml rename to install/k8s/rbac/contiv.yaml diff --git a/install/k8s/k8s1.6/etcd.yaml b/install/k8s/rbac/etcd.yaml similarity index 100% rename from install/k8s/k8s1.6/etcd.yaml rename to install/k8s/rbac/etcd.yaml diff --git a/install/k8s/k8s1.6/prometheus.yml b/install/k8s/rbac/prometheus.yml similarity index 100% rename from install/k8s/k8s1.6/prometheus.yml rename to install/k8s/rbac/prometheus.yml diff --git a/install/k8s/uninstall.sh b/install/k8s/uninstall.sh index 3004f2d..5bd6748 100755 --- a/install/k8s/uninstall.sh +++ b/install/k8s/uninstall.sh @@ -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"