3 if grep -q -e rhel /etc/*-release; then
5 elif grep -q -e debian /etc/*-release; then
9 case ${OS_ID_LIKE:-} in
11 DOCKER_VERSION=18.06.1~ce~3-0~ubuntu
12 KUBE_VERSION=${1:-1.13.0}-00
13 K8S_CNI_VERSION=${2:-0.6.0}-00
14 KUBELET_CFG=/etc/default/kubelet
17 DOCKER_VERSION=18.06.1.ce-3.el7
18 KUBE_VERSION=${1:-1.13.0}-0
19 K8S_CNI_VERSION=${2:-0.6.0}-0
20 KUBELET_CFG=/etc/sysconfig/kubelet
23 echo 'Unsupported distribution detected!'
29 case ${OS_ID_LIKE:-} in
31 # Install basic software
32 echo "Acquire::ForceIPv4 \"true\";" | sudo tee -a /etc/apt/apt.conf.d/99force-ipv4 > /dev/null
34 sudo apt install -y software-properties-common apt-transport-https curl
36 # Install Docker as Prerequisite
37 curl -4fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
38 sudo apt-key fingerprint 0EBFCD88
39 sudo add-apt-repository \
40 "deb https://download.docker.com/linux/ubuntu \
44 sudo apt install -y docker-ce=${DOCKER_VERSION}
47 sudo yum install -y yum-utils device-mapper-persistent-data lvm2
48 sudo yum-config-manager --add-repo \
49 https://download.docker.com/linux/centos/docker-ce.repo
51 docker-ce-$DOCKER_VERSION \
52 docker-ce-cli-$DOCKER_VERSION \
57 # Disable swap on your machine
60 case ${OS_ID_LIKE:-} in
62 # Install Kubernetes with Kubeadm
63 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
65 cat <<-EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
66 deb https://apt.kubernetes.io/ kubernetes-xenial main
69 # Minor fix for broken kubernetes-cni dependency in upstream xenial repo
71 kubernetes-cni=${K8S_CNI_VERSION} kubelet=${KUBE_VERSION} \
72 kubeadm=${KUBE_VERSION} kubectl=${KUBE_VERSION}
73 sudo apt-mark hold kubernetes-cni kubelet kubeadm kubectl
76 cat <<-EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
79 baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$(uname -m)
83 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
84 https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
86 sudo yum install -y kubelet-$KUBE_VERSION kubeadm-$KUBE_VERSION \
87 kubectl-$KUBE_VERSION kubernetes-cni-$K8S_CNI_VERSION
91 # Add extra flags to Kubelet
92 if [ ! -f "$KUBELET_CFG" ]; then
93 echo 'KUBELET_EXTRA_ARGS=--fail-swap-on=false' | sudo tee $KUBELET_CFG > /dev/null
94 elif ! grep -q -e 'fail-swap-on' $KUBELET_CFG; then
95 sudo sed 's/KUBELET_EXTRA_ARGS=/KUBELET_EXTRA_ARGS=--fail-swap-on=false/' -i $KUBELET_CFG
98 sudo systemctl enable docker kubelet
99 sudo systemctl restart docker kubelet
101 sudo modprobe br_netfilter
102 _conf='/etc/sysctl.d/99-akraino-iec.conf'
103 echo 'net.bridge.bridge-nf-call-iptables = 1' |& sudo tee "${_conf}"
104 sudo sysctl -q -p "${_conf}"