k8s_centos 19/1419/4
authorSrinivasan Selvam <srinivasan.s.n@huawei.com>
Fri, 16 Aug 2019 09:27:40 +0000 (09:27 +0000)
committerSrinivasan Selvam <srinivasan.s.n@huawei.com>
Mon, 19 Aug 2019 11:07:41 +0000 (11:07 +0000)
Signed-off-by: Srinivasan Selvam <srinivasan.s.n@huawei.com>
Change-Id: I7ee802d859e4418d282eb69b405eda250871a4a7

scripts/common_centos.sh
scripts/k8smaster_centos.sh
scripts/setup.sh

index 5532ac2..1fb51b3 100755 (executable)
@@ -52,6 +52,13 @@ gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
         https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
 EOF
 
         https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
 EOF
 
+# Set SELinux in permissive mode (effectively disabling it)
+setenforce 0
+sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
+
+yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
+systemctl enable --now kubelet
+
 sudo yum install -y kubeadm-${KUBE_VERSION}
 sudo systemctl start docker && sudo systemctl enable docker
 
 sudo yum install -y kubeadm-${KUBE_VERSION}
 sudo systemctl start docker && sudo systemctl enable docker
 
index 2681b6e..c78bc0d 100755 (executable)
@@ -25,12 +25,6 @@ rm hostname.tmp
 sudo yum install -y kubelet-${KUBE_VERSION} kubectl-${KUBE_VERSION} \
 kubernetes-cni-${KUBERNETES_CNI}
 
 sudo yum install -y kubelet-${KUBE_VERSION} kubectl-${KUBE_VERSION} \
 kubernetes-cni-${KUBERNETES_CNI}
 
-sudo systemctl start kubelet #&& sudo systemctl enable kubelet
-
-sudo docker info | grep -i cgroup
-sudo sed -i 's/cgroup-driver=systemd/cgroup-driver=cgroupfs/g' \
-/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
-
 sudo systemctl daemon-reload
 sudo systemctl restart kubelet
 
 sudo systemctl daemon-reload
 sudo systemctl restart kubelet
 
index 07cecd3..4062c7e 100755 (executable)
@@ -70,9 +70,9 @@ setup_k8sworkers()
      nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1)
      nodeip=$(echo ${nodeinfo} | cut -d"|" -f2)
      nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3)
      nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1)
      nodeip=$(echo ${nodeinfo} | cut -d"|" -f2)
      nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3)
-     sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER_COMMON} < /dev/null
-     sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER} < /dev/null
-     sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${KUBEADM_JOIN} < /dev/null
+     sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER_COMMON} < /dev/null 2>&1
+     sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER} < /dev/null 2>&1
+     sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${KUBEADM_JOIN} < /dev/null 2>&1
  done < nodelist > /dev/null 2>&1
 
 }
  done < nodelist > /dev/null 2>&1
 
 }
@@ -87,9 +87,9 @@ setup_k8smaster_centos()
   # Setup ELIOT Node
   setup_k8sworkers_centos
 
   # Setup ELIOT Node
   setup_k8sworkers_centos
 
-  cd cni/calico
-  kubectl apply -f rbac.yaml
-  kubectl apply -f calico.yaml
+  kubectl apply -f cni/calico/rbac.yaml
+  kubectl apply -f cni/calico/calico.yaml
+
 }
 
 
 }
 
 
@@ -102,24 +102,24 @@ setup_k8sworkers_centos()
                               git clone ${ELIOT_REPO} &&\
                               cd eliot/scripts && source common_centos.sh"
 
                               git clone ${ELIOT_REPO} &&\
                               cd eliot/scripts && source common_centos.sh"
 
+  # SETUP_WORKER_COMMON_CENTOS="cd /root/eliot/scripts && source common_centos.sh"
+
   KUBEADM_TOKEN=$(sudo kubeadm token create --print-join-command)
   KUBEADM_JOIN_CENTOS="sudo ${KUBEADM_TOKEN}"
   KUBEADM_TOKEN=$(sudo kubeadm token create --print-join-command)
   KUBEADM_JOIN_CENTOS="sudo ${KUBEADM_TOKEN}"
-
- # Read all the Worker Node details from nodelist file.
- while read line
- do
-     nodeinfo="${line}"
-     nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1)
-     nodeip=$(echo ${nodeinfo} | cut -d"|" -f2)
-     nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3)
-     sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER_COMMON_CENTOS} < /dev/null
-     #sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER_CENTOS} < /dev/null
-     sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${KUBEADM_JOIN_CENTOS} < /dev/null
- done < nodelist
+  # Read all the Worker Node details from nodelist file.
+  while read line
+  do
+      nodeinfo="${line}" < /dev/null 2>&1
+      nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1) < /dev/null 2>&1
+      nodeip=$(echo ${nodeinfo} | cut -d"|" -f2)  < /dev/null 2>&1
+      nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3) < /dev/null 2>&1
+      sudo sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_WORKER_COMMON_CENTOS} < /dev/null 2>&1
+      sudo sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${KUBEADM_JOIN_CENTOS} < /dev/null 2>&1
+  done < nodelist > /dev/null 2>&1
 
 }
 
 
 }
 
-#verify kubernetes setup by deploying nginx server.
+# verify kubernetes setup by deploying nginx server.
 
 verify_k8s_status(){
   set -o xtrace
 
 verify_k8s_status(){
   set -o xtrace
@@ -128,7 +128,7 @@ verify_k8s_status(){
 
 install_cadvisor_edge(){
  set -o xtrace
 
 install_cadvisor_edge(){
  set -o xtrace
- SETUP_CADVISOR_ATEDGE="cd eliot/scripts/ && source cadvisorsetup.sh" 
+ SETUP_CADVISOR_ATEDGE="cd eliot/scripts/ && source cadvisorsetup.sh"
  while read line
  do
      nodeinfo="${line}"
  while read line
  do
      nodeinfo="${line}"