Enable extra flag for both master and nodes 90/490/4
authortrevortao <trevor.tao@arm.com>
Tue, 19 Mar 2019 08:56:24 +0000 (16:56 +0800)
committertrevortao <trevor.tao@arm.com>
Thu, 21 Mar 2019 06:56:48 +0000 (14:56 +0800)
Enable extra flag as k8s common for both k8s master and slave:
      --fail-swap-on=false
      --feature-gates HugePages=false

Change-Id: I3051796bbe083011837415ab07dbb1eb68a2fb55
Signed-off-by: trevortao <trevor.tao@arm.com>
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 \