X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ffoundation%2Fscripts%2Fk8s_common.sh;h=4002ca8fc4cbfbc141f8582e0a9d6bafd83af597;hb=5cc1b8658cb9185ac5bc6f72d5b6cbc6fa2c37dc;hp=d9c536f26e0dfdbcee814a53ee5ccc44b7f4323b;hpb=cdf87579398c63dd8b107e34f1d0ffba0b93009f;p=iec.git diff --git a/src/foundation/scripts/k8s_common.sh b/src/foundation/scripts/k8s_common.sh index d9c536f..4002ca8 100755 --- a/src/foundation/scripts/k8s_common.sh +++ b/src/foundation/scripts/k8s_common.sh @@ -9,14 +9,14 @@ fi case ${OS_ID_LIKE:-} in debian) DOCKER_VERSION=18.06.1~ce~3-0~ubuntu - KUBE_VERSION=1.13.0-00 - K8S_CNI_VERSION=0.6.0-00 + KUBE_VERSION=${1:-1.22.0}-00 + K8S_CNI_VERSION=${2:-0.8.7}-00 KUBELET_CFG=/etc/default/kubelet ;; rhel) DOCKER_VERSION=18.06.1.ce-3.el7 - KUBE_VERSION=1.13.0-0 - K8S_CNI_VERSION=0.6.0-0 + KUBE_VERSION=${1:-1.22.0}-0 + K8S_CNI_VERSION=${2:-0.8.7}-0 KUBELET_CFG=/etc/sysconfig/kubelet ;; *) @@ -25,12 +25,13 @@ rhel) ;; esac + case ${OS_ID_LIKE:-} in debian) # Install basic software echo "Acquire::ForceIPv4 \"true\";" | sudo tee -a /etc/apt/apt.conf.d/99force-ipv4 > /dev/null sudo apt update - sudo apt install -y software-properties-common apt-transport-https curl + sudo apt install -y software-properties-common apt-transport-https curl python3-pip # Install Docker as Prerequisite curl -4fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - @@ -40,7 +41,8 @@ debian) $(lsb_release -cs) \ stable" sudo apt update - sudo apt install -y docker-ce=${DOCKER_VERSION} + #sudo apt install -y docker-ce=${DOCKER_VERSION} + sudo apt install -y docker-ce ;; rhel) sudo yum install -y yum-utils device-mapper-persistent-data lvm2 @@ -64,6 +66,7 @@ debian) cat <<-EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF + sudo apt remove -f kubeadm kubectl kubernetes-cni kubelet sudo apt update # Minor fix for broken kubernetes-cni dependency in upstream xenial repo sudo apt install -y \ @@ -88,8 +91,10 @@ EOF esac # Add extra flags to Kubelet -if ! grep -q -e 'fail-swap-on' $KUBELET_CFG; then - sudo sed 's/KUBELET_EXTRA_ARGS=/KUBELET_EXTRA_ARGS=--fail-swap-on=false --feature-gates HugePages=false/' -i $KUBELET_CFG +if [ ! -f "$KUBELET_CFG" ]; then + echo 'KUBELET_EXTRA_ARGS=--fail-swap-on=false' | sudo tee $KUBELET_CFG > /dev/null +elif ! grep -q -e 'fail-swap-on' $KUBELET_CFG; then + sudo sed 's/KUBELET_EXTRA_ARGS=/KUBELET_EXTRA_ARGS=--fail-swap-on=false/' -i $KUBELET_CFG fi sudo systemctl enable docker kubelet @@ -98,4 +103,6 @@ sudo systemctl restart docker kubelet sudo modprobe br_netfilter _conf='/etc/sysctl.d/99-akraino-iec.conf' echo 'net.bridge.bridge-nf-call-iptables = 1' |& sudo tee "${_conf}" +# Set memory overcommit to 0 for extra checks during memory allocation +echo 'vm.overcommit_memory = 0' |& sudo tee -a "${_conf}" sudo sysctl -q -p "${_conf}"