.. This work is licensed under a Creative Commons Attribution 4.0 .. International License. .. http://creativecommons.org/licenses/by/4.0 .. Copyright 2018-2020 Amdocs, Bell Canada, Orange, Samsung .. Links .. _HELM Best Practices Guide: https://docs.helm.sh/chart_best_practices/#requirements .. _kubectl Cheat Sheet: https://kubernetes.io/docs/reference/kubectl/cheatsheet/ .. _Kubernetes documentation for emptyDir: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir .. _Docker DevOps: https://wiki.onap.org/display/DW/Docker+DevOps#DockerDevOps-DockerBuild .. _http://cd.onap.info:30223/mso/logging/debug: http://cd.onap.info:30223/mso/logging/debug .. _Onboarding and Distributing a Vendor Software Product: https://wiki.onap.org/pages/viewpage.action?pageId=1018474 .. _README.md: https://gerrit.onap.org/r/gitweb?p=oom.git;a=blob;f=kubernetes/README.md .. figure:: oomLogoV2-medium.png :align: right .. _onap-on-kubernetes-with-rancher: ONAP on HA Kubernetes Cluster ############################# This guide provides instructions on how to setup a Highly-Available Kubernetes Cluster. For this, we are hosting our cluster on OpenStack VMs and using the Rancher Kubernetes Engine (RKE) to deploy and manage our Kubernetes Cluster. .. contents:: :depth: 1 :local: .. The result at the end of this tutorial will be: #. Creation of a Key Pair to use with Open Stack and RKE #. Creation of OpenStack VMs to host Kubernetes Control Plane #. Creation of OpenStack VMs to host Kubernetes Workers #. Installation and configuration of RKE to setup an HA Kubernetes #. Installation and configuration of kubectl #. Installation and configuration of Helm #. Creation of an NFS Server to be used by ONAP as shared persistance There are many ways one can execute the above steps. Including automation through the use of HEAT to setup the OpenStack VMs. To better illustrate the steps involved, we have captured the manual creation of such an environment using the ONAP Wind River Open Lab. Create Key Pair =============== A Key Pair is required to access the created OpenStack VMs and will be used by RKE to configure the VMs for Kubernetes. Use an existing key pair, import one or create a new one to assign. .. image:: images/keys/key_pair_1.png .. Note:: If you're creating a new Key Pair, ensure to create a local copy of the Private Key through the use of "Copy Private Key to Clipboard". For the purpose of this guide, we will assume a new local key called "onap-key" has been downloaded and is copied into **~/.ssh/**, from which it can be referenced. Example:: > mv onap-key ~/.ssh > chmod 600 ~/.ssh/onap-key Create Network ============== An internal network is required in order to deploy our VMs that will host Kubernetes. .. image:: images/network/network_1.png .. image:: images/network/network_2.png .. image:: images/network/network_3.png .. Note:: It's better to have one network per deployment and obviously the name of this network should be unique. Now we need to create a router to attach this network to outside: .. image:: images/network/network_4.png Create Security Group ===================== A specific security group is also required .. image:: images/sg/sg_1.png then click on `manage rules` of the newly created security group. And finally click on `Add Rule` and create the following one: .. image:: images/sg/sg_2.png .. Note:: the security is clearly not good here and the right SG will be proposed in a future version Create Kubernetes Control Plane VMs =================================== The following instructions describe how to create 3 OpenStack VMs to host the Highly-Available Kubernetes Control Plane. ONAP workloads will not be scheduled on these Control Plane nodes. Launch new VM instances ----------------------- .. image:: images/cp_vms/control_plane_1.png Select Ubuntu 18.04 as base image --------------------------------- Select "No" for "Create New Volume" .. image:: images/cp_vms/control_plane_2.png Select Flavor ------------- The recommended flavor is at least 4 vCPU and 8GB ram. .. image:: images/cp_vms/control_plane_3.png Networking ---------- Use the created network: .. image:: images/cp_vms/control_plane_4.png Security Groups --------------- Use the created security group: .. image:: images/cp_vms/control_plane_5.png Key Pair -------- Assign the key pair that was created/selected previously (e.g. onap_key). .. image:: images/cp_vms/control_plane_6.png Apply customization script for Control Plane VMs ------------------------------------------------ Click :download:`openstack-k8s-controlnode.sh ` to download the script. .. literalinclude:: openstack-k8s-controlnode.sh :language: bash This customization script will: * update ubuntu * install docker .. image:: images/cp_vms/control_plane_7.png Launch Instance --------------- .. image:: images/cp_vms/control_plane_8.png Create Kubernetes Worker VMs ============================ The following instructions describe how to create OpenStack VMs to host the Highly-Available Kubernetes Workers. ONAP workloads will only be scheduled on these nodes. Launch new VM instances ----------------------- The number and size of Worker VMs is dependent on the size of the ONAP deployment. By default, all ONAP applications are deployed. It's possible to customize the deployment and enable a subset of the ONAP applications. For the purpose of this guide, however, we will deploy 12 Kubernetes Workers that have been sized to handle the entire ONAP application workload. .. image:: images/wk_vms/worker_1.png Select Ubuntu 18.04 as base image --------------------------------- Select "No" on "Create New Volume" .. image:: images/wk_vms/worker_2.png Select Flavor ------------- The size of Kubernetes hosts depend on the size of the ONAP deployment being installed. If a small subset of ONAP applications are being deployed (i.e. for
*** Settings ***
Documentation     The main interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields
Library           ONAPLibrary.Openstack
Library         RequestsLibrary
Library           ONAPLibrary.Utilities
Library           ONAPLibrary.Templating    WITH NAME    Templating
Resource    ../global_properties.robot
Resource    openstack_common.robot


*** Variables ***
${OPENSTACK_CINDER_API_VERSION}    /v1
${OPENSTACK_CINDER_TYPES_PATH}    /types
${OPENSTACK_CINDER_VOLUMES_PATH}    /volumes
${OPENSTACK_CINDER_VOLUMES_ADD_BODY_FILE}        openstack/cinder_add_volume.jinja
${OPENSTACK_CINDER_VOLUMES_TYPE}    SSD
${OPENSTACK_CINDER_AVAILABILITY_ZONE}    nova

*** Keywords ***
Get Openstack Volume Types
    [Documentation]    Returns the openstack volume types information
    [Arguments]    ${alias}