The software-properties-common software is essential
for add-apt-repository. Add it into k8s_common.sh file.
Fix bugs when running sshpass
Signed-off-by: Jingzhao.Ni <Jingzhao.Ni@arm.com>
Change-Id: I651dbee12177db72bd69708355250c0b005d347d
KUBE_VERSION=1.13.0-00
K8S_CNI_VERSION=0.6.0-00
KUBE_VERSION=1.13.0-00
K8S_CNI_VERSION=0.6.0-00
+# Install basic software
+sudo apt update
+sudo apt install -y software-properties-common apt-transport-https curl
+
# Install Docker as Prerequisite
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
# Install Docker as Prerequisite
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo swapoff -a
# Install Kubernetes with Kubeadm
sudo swapoff -a
# Install Kubernetes with Kubeadm
-sudo apt update
-sudo apt install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo sed 's/KUBELET_EXTRA_ARGS=/KUBELET_EXTRA_ARGS=--fail-swap-on=false --feature-gates HugePages=false/' -i /etc/default/kubelet
fi
sudo sed 's/KUBELET_EXTRA_ARGS=/KUBELET_EXTRA_ARGS=--fail-swap-on=false --feature-gates HugePages=false/' -i /etc/default/kubelet
fi
+sudo modprobe br_netfilter
_conf='/etc/sysctl.d/99-akraino-iec.conf'
echo 'net.bridge.bridge-nf-call-iptables = 1' |& sudo tee "${_conf}"
sudo sysctl -q -p "${_conf}"
_conf='/etc/sysctl.d/99-akraino-iec.conf'
echo 'net.bridge.bridge-nf-call-iptables = 1' |& sudo tee "${_conf}"
sudo sysctl -q -p "${_conf}"
sudo cp -i /etc/kubernetes/admin.conf "${HOME}/.kube/config"
sudo chown "$(id -u)":"$(id -g)" "${HOME}/.kube/config"
fi
sudo cp -i /etc/kubernetes/admin.conf "${HOME}/.kube/config"
sudo chown "$(id -u)":"$(id -g)" "${HOME}/.kube/config"
fi
+ sleep 5
+ sudo swapon -a
#Automatic deploy the K8s environments on Master node
SETUP_MASTER="cd iec/src/foundation/scripts/ && source k8s_master.sh ${K8S_MASTER_IP}"
#Automatic deploy the K8s environments on Master node
SETUP_MASTER="cd iec/src/foundation/scripts/ && source k8s_master.sh ${K8S_MASTER_IP}"
- sshpass -p ${K8S_MASTERPW} ssh ${HOST_USER}@${K8S_MASTER_IP} ${INSTALL_SOFTWARE}
- sshpass -p ${K8S_MASTERPW} ssh ${HOST_USER}@${K8S_MASTER_IP} ${SETUP_MASTER} | tee ${LOG_FILE}
+ sshpass -p ${K8S_MASTERPW} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${K8S_MASTER_IP} ${INSTALL_SOFTWARE}
+ sshpass -p ${K8S_MASTERPW} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${K8S_MASTER_IP} ${SETUP_MASTER} | tee ${LOG_FILE}
KUBEADM_JOIN_CMD=$(grep "kubeadm join " ./${LOG_FILE})
KUBEADM_JOIN_CMD=$(grep "kubeadm join " ./${LOG_FILE})
passwd="$(cut -d',' -f2 <<<${worker})"
echo "Install & Deploy on ${ip_addr}. password:${passwd}"
passwd="$(cut -d',' -f2 <<<${worker})"
echo "Install & Deploy on ${ip_addr}. password:${passwd}"
- sshpass -p ${passwd} ssh ${HOST_USER}@${ip_addr} ${INSTALL_SOFTWARE}
- sshpass -p ${passwd} ssh ${HOST_USER}@${ip_addr} "echo \"sudo ${KUBEADM_JOIN_CMD}\" >> ./iec/src/foundation/scripts/k8s_worker.sh"
- sshpass -p ${passwd} ssh ${HOST_USER}@${ip_addr} ${SETUP_WORKER}
+ sshpass -p ${passwd} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${ip_addr} ${INSTALL_SOFTWARE}
+ sshpass -p ${passwd} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${ip_addr} "echo \"sudo ${KUBEADM_JOIN_CMD}\" >> ./iec/src/foundation/scripts/k8s_worker.sh"
+ sleep 2
+ sshpass -p ${passwd} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${ip_addr} "swapon -a"
+ sshpass -p ${passwd} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${ip_addr} ${SETUP_WORKER}
done
#Deploy etcd & CNI from master node
#There may be more options in future. e.g: Calico, Contiv-vpp, Ovn-k8s ...
done
#Deploy etcd & CNI from master node
#There may be more options in future. e.g: Calico, Contiv-vpp, Ovn-k8s ...
- SETUP_CNI="cd iec/src/foundation/scripts && source setup-cni.sh"
- sshpass -p ${K8S_MASTERPW} ssh ${HOST_USER}@${K8S_MASTER_IP} ${SETUP_CNI}
+ SETUP_CNI="KUBECONFIG=/etc/kubernetes/admin.conf && cd iec/src/foundation/scripts && source setup-cni.sh"
+ sshpass -p ${K8S_MASTERPW} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${K8S_MASTER_IP} ${SETUP_CNI}
+ SETUP_HELM="KUBECONFIG=/etc/kubernetes/admin.conf && cd iec/src/foundation/scripts && source helm.sh"
+ sshpass -p ${K8S_MASTERPW} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${K8S_MASTER_IP} ${SETUP_HELM}
+
set -o xtrace
VERIFY_K8S="cd iec/src/foundation/scripts/ && source nginx.sh"
set -o xtrace
VERIFY_K8S="cd iec/src/foundation/scripts/ && source nginx.sh"
- sshpass -p ${K8S_MASTERPW} ssh ${HOST_USER}@${K8S_MASTER_IP} ${VERIFY_K8S}
-
- sleep 30
+ sshpass -p ${K8S_MASTERPW} ssh -o StrictHostKeyChecking=no ${HOST_USER}@${K8S_MASTER_IP} ${VERIFY_K8S}
-if [ $1 == "--help" ] || [ $1 == "-h" ];
+ if [ $1 == "--help" ] || [ $1 == "-h" ];
+ then
+ display_help
+ exit 0
+ fi
# Read the configuration file
source config
# Read the configuration file
source config