From dc8a9e234e09158b1df98d1128399bf5ea3dac0f Mon Sep 17 00:00:00 2001 From: trevortao Date: Tue, 19 Mar 2019 16:56:24 +0800 Subject: [PATCH] Enable extra flag for both master and nodes 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 --- src/foundation/scripts/k8s_common.sh | 5 +++++ src/foundation/scripts/k8s_master.sh | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/foundation/scripts/k8s_common.sh b/src/foundation/scripts/k8s_common.sh index 9a44834..e1e086d 100755 --- a/src/foundation/scripts/k8s_common.sh +++ b/src/foundation/scripts/k8s_common.sh @@ -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}" diff --git a/src/foundation/scripts/k8s_master.sh b/src/foundation/scripts/k8s_master.sh index 5eb9082..1782769 100755 --- a/src/foundation/scripts/k8s_master.sh +++ b/src/foundation/scripts/k8s_master.sh @@ -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 \ -- 2.16.6