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.19.0}-00
13 K8S_CNI_VERSION=${2:-0.8.6}-00
14 KUBELET_CFG=/etc/default/kubelet
17 DOCKER_VERSION=18.06.1.ce-3.el7
18 KUBE_VERSION=${1:-1.19.0}-0
19 K8S_CNI_VERSION=${2:-0.8.6}-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 python-pip
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}
45 sudo apt install -y docker-ce
48 sudo yum install -y yum-utils device-mapper-persistent-data lvm2
49 sudo yum-config-manager --add-repo \
50 https://download.docker.com/linux/centos/docker-ce.repo
52 docker-ce-$DOCKER_VERSION \
53 docker-ce-cli-$DOCKER_VERSION \
58 # Disable swap on your machine
61 case ${OS_ID_LIKE:-} in
63 # Install Kubernetes with Kubeadm
64 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
66 cat <<-EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
67 deb https://apt.kubernetes.io/ kubernetes-xenial main
70 # Minor fix for broken kubernetes-cni dependency in upstream xenial repo
72 kubernetes-cni=${K8S_CNI_VERSION} kubelet=${KUBE_VERSION} \
73 kubeadm=${KUBE_VERSION} kubectl=${KUBE_VERSION}
74 sudo apt-mark hold kubernetes-cni kubelet kubeadm kubectl
77 cat <<-EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
80 baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$(uname -m)
84 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
85 https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
87 sudo yum install -y kubelet-$KUBE_VERSION kubeadm-$KUBE_VERSION \
88 kubectl-$KUBE_VERSION kubernetes-cni-$K8S_CNI_VERSION
92 # Add extra flags to Kubelet
93 if [ ! -f "$KUBELET_CFG" ]; then
94 echo 'KUBELET_EXTRA_ARGS=--fail-swap-on=false' | sudo tee $KUBELET_CFG > /dev/null
95 elif ! grep -q -e 'fail-swap-on' $KUBELET_CFG; then
96 sudo sed 's/KUBELET_EXTRA_ARGS=/KUBELET_EXTRA_ARGS=--fail-swap-on=false/' -i $KUBELET_CFG
99 sudo systemctl enable docker kubelet
100 sudo systemctl restart docker kubelet
102 sudo modprobe br_netfilter
103 _conf='/etc/sysctl.d/99-akraino-iec.conf'
104 echo 'net.bridge.bridge-nf-call-iptables = 1' |& sudo tee "${_conf}"
105 # Set memory overcommit to 0 for extra checks during memory allocation
106 echo 'vm.overcommit_memory = 0' |& sudo tee -a "${_conf}"
107 sudo sysctl -q -p "${_conf}"