Merge "Enable extra flag for both master and nodes"
authorTrevor Tao <trevor.tao@arm.com>
Mon, 25 Mar 2019 08:42:43 +0000 (08:42 +0000)
committerGerrit Code Review <gerrit@akraino.org>
Mon, 25 Mar 2019 08:42:43 +0000 (08:42 +0000)
src/foundation/scripts/k8s_common.sh
src/foundation/scripts/k8s_master.sh

index 9a44834..e1e086d 100755 (executable)
@@ -29,6 +29,11 @@ sudo apt install -y \
   kubelet=${KUBE_VERSION} kubeadm=${KUBE_VERSION} kubectl=${KUBE_VERSION}
 sudo apt-mark hold kubelet kubeadm kubectl
 
+#Add extra flags to Kubelet
+if ! grep -q -e 'fail-swap-on' /etc/default/kubelet; then
+   sudo sed 's/KUBELET_EXTRA_ARGS=/KUBELET_EXTRA_ARGS=--fail-swap-on=false --feature-gates HugePages=false/' -i /etc/default/kubelet
+fi
+
 _conf='/etc/sysctl.d/99-akraino-iec.conf'
 echo 'net.bridge.bridge-nf-call-iptables = 1' |& sudo tee "${_conf}"
 sudo sysctl -q -p "${_conf}"
index 5eb9082..1782769 100755 (executable)
@@ -10,9 +10,6 @@ if [ -z "${MGMT_IP}" ]; then
   exit 1
 fi
 
-#Add extra flags to Kubelet
-sed '/Environment=\"KUBELET_CONFIG_ARGS/a\Environment=\"KUBELET_EXTRA_ARGS=--fail-swap-on=false --feature-gates HugePages=false\"' -i /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
-
 if ! kubectl get nodes; then
   sudo kubeadm config images pull
   sudo kubeadm init \