Changes between Version 4 and Version 5 of Tutorials/Cloud/ONAP


Ignore:
Timestamp:
Oct 18, 2019, 8:33:34 AM (5 years ago)
Author:
hanif
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/Cloud/ONAP

    v4 v5  
    1414
    1515-- Running performant physical server cluster
     16For the purpose of orbit-lab, execute the below script on any of the console node in orbit as below:
     17\\./create-kube-cluster.sh -c "cNode1 cNode2 ... cNodeM" -w "wNode1 wNode2 ... wNodeN"
     18
     19create-kube-cluster.sh
     20{{{
     21#!/bin/bash
     22
     23rm -f cluster.yml
     24rm -f rke
     25rm -f config
     26
     27wget https://github.com/rancher/rke/releases/download/v0.2.1/rke_linux-amd64
     28mv rke_linux-amd64 rke
     29chmod 754 rke
     30
     31
     32usage () {
     33  echo "Usage:"
     34  echo "   ./$(basename $0) -c \"cNode1 cNode2 ... cnodeN\" -w \"wNode1 wnode2 ... wnodeN\""
     35  echo "Note: controllers hostnames and workers hostnames are to be enclosed in \"\""
     36  exit 0
     37}
     38
     39if [[ ( $# == "--help") ||  $# == "-h" ]]
     40        then
     41                usage
     42                exit 0
     43fi
     44
     45if [ "$#" -lt 2 ]; then
     46  echo "Missing Kubernetes control and worker nodes"
     47  usage
     48fi
     49
     50echo "# An example of an HA Kubernetes cluster for ONAP" >> cluster.yml
     51echo "nodes:" >> cluster.yml
     52
     53while getopts c:w: option
     54do
     55case "${option}"
     56in
     57c) CONTROLLERS=${OPTARG};;
     58w) WORKERS=${OPTARG};;
     59esac
     60done
     61
     62#omf load -i latest-onap-control.ndz -t ${CONTROLLERS// /,}
     63#omf load -i latest-onap-worker.ndz -t ${WORKERS// /,}
     64#omf tell -a on -t ${CONTROLLERS// /,},${WORKERS// /,}
     65
     66IFS=' ' read -ra C <<< "$CONTROLLERS"
     67IFS=' ' read -ra W <<< "$WORKERS"
     68
     69echo "Testing node availability. This might take some time"
     70for i in "${C[@]}"; do
     71while ! ping -c 1 -n -w 1 $i &> /dev/null
     72do
     73    printf "%c" "."
     74done
     75echo "127.0.0.1 localhost" > hosts
     76echo "`ping $i -c 1 | grep "PING" | grep '('|awk '{gsub(/[()]/,""); print $3}'` ${i}" >> hosts
     77scp hosts root@$i:/etc/hosts
     78done
     79
     80for i in "${W[@]}"; do
     81while ! ping -c 1 -n -w 1 $i &> /dev/null
     82do
     83    printf "%c" "."
     84done
     85echo "127.0.0.1 localhost" > hosts
     86echo "`ping $i -c 1 | grep "PING" | grep '('|awk '{gsub(/[()]/,""); print $3}'` ${i}" >> hosts
     87scp hosts root@$i:/etc/hosts
     88done
     89echo "Availability check successful"
     90
     91for i in "${C[@]}"; do
     92   echo "- address: `ping $i -c 1 | grep "PING" | grep '('|awk '{gsub(/[()]/,""); print $3}'`" >> cluster.yml
     93   echo '  port: "22"' >> cluster.yml
     94   echo "  role:" >> cluster.yml
     95   echo "  - controlplane" >> cluster.yml
     96   echo "  - etcd" >> cluster.yml
     97   echo "  hostname_override: `ping $i -c 1 | grep 'PING' | awk '{print $2}' | awk -F . '{print $1}'`" >> cluster.yml
     98   echo "  user: root" >> cluster.yml
     99   echo "  ssh_key_path: '~/.ssh/id_rsa'" >> cluster.yml
     100done
     101
     102echo "# worker nodes start " >> cluster.yml
     103
     104for i in "${W[@]}"; do
     105   echo "- address: `ping $i -c 1 | grep "PING" | grep '('|awk '{gsub(/[()]/,""); print $3}'`" >> cluster.yml
     106   echo '  port: "22"' >> cluster.yml
     107   echo "  role:" >> cluster.yml
     108   echo "  - worker" >> cluster.yml
     109   echo "  hostname_override: `ping $i -c 1 | grep 'PING' | awk '{print $2}' | awk -F . '{print $1}'`" >> cluster.yml
     110   echo "  user: root" >> cluster.yml
     111   echo "  ssh_key_path: '~/.ssh/id_rsa'" >> cluster.yml
     112done
     113
     114echo 'services:
     115  kube-api:
     116    service_cluster_ip_range: 10.43.0.0/16
     117    pod_security_policy: false
     118    always_pull_images: false
     119  kube-controller:
     120    cluster_cidr: 10.42.0.0/16
     121    service_cluster_ip_range: 10.43.0.0/16
     122  kubelet:
     123    cluster_domain: cluster.local
     124    cluster_dns_server: 10.43.0.10
     125    fail_swap_on: false
     126network:
     127  plugin: canal
     128authentication:
     129  strategy: x509
     130ssh_key_path: "~/.ssh/id_rsa"
     131ssh_agent_auth: false
     132authorization:
     133  mode: rbac
     134ignore_docker_version: false
     135kubernetes_version: "v1.13.5-rancher1-2"
     136private_registries:
     137- url: nexus3.onap.org:10001
     138  user: docker
     139  password: docker
     140  is_default: true
     141cluster_name: "onap"
     142restore:
     143  restore: false
     144  snapshot_name: ""' >> cluster.yml
     145
     146./rke up
     147
     148for i in "${C[@]}"; do
     149scp kube_config_cluster.yml root@$i:~/.kube/config
     150done
     151
     152exit 0
     153}}}
     154
    16155
    17156-- Openstack installed