# Multi cluster installation ## Introduction Multi Cluster installation is an important features for production deployments. Most of the project are using the Kubernetes as undercloud orchestration. So deploying multi cluster for the multi cloud region should be maintained by Kubernetes This section explains how to deploy the Multi cluster of Kubernetes from a containerized KUD running as a Kubernetes Job. ## How it works KUD installation installer is divided into two regions with args - `--install-pkg` and `--cluster ` ### Args **--install-pkg** - Installs packages required to run installer script itself inside a container and kubespray packages **--cluster < cluster-name >** - Installs k8s cluster, addons and plugins and store the artifacts in the host machine ### Internal Mechanism * Container image is build using the `installer --install-pkg` arg and Kubernetes job is used to install the cluster using `installer --cluster `. Installer will invoke the kubespray cluster.yml, kud-addsons and plugins ansible cluster. Installer script finds the `hosts.init` for each cluster in `/opt/multi-cluster/` Kubernetes jobs(a cluster per job) are used to install multiple clusters and logs of each cluster deployments are stored in the `/opt/kud/multi-cluster//logs` and artifacts are stored as follows `/opt/kud/multi-cluster//artifacts` ## Quickstart Installation Guide Build the kud docker images as follows: ``` $ git clone https://github.com/onap/multicloud-k8s.git && cd multicloud-k8s $ docker build --rm \ --build-arg http_proxy=${http_proxy} \ --build-arg HTTP_PROXY=${HTTP_PROXY} \ --build-arg https_proxy=${https_proxy} \ --build-arg HTTPS_PROXY=${HTTPS_PROXY} \ --build-arg no_proxy=${no_proxy} \ --build-arg NO_PROXY=${NO_PROXY} \ -t github.com/onap/multicloud-k8s:latest . -f build/Dockerfile ``` Let's create a cluster-101 and cluster-102 hosts.ini as follows ``` $ mkdir -p /opt/kud/multi-cluster/{cluster-101,cluster-102} ``` Create hosts.ini as follows in the direcotry cluster-101(c01 IP address 10.10.10.3) and cluster-102(c02 IP address 10.10.10.5) ``` /opt/kud/multi-cluster/cluster-101/hosts.ini [all] c01 ansible_ssh_host=10.10.10.5 ansible_ssh_port=22 [kube-master] c01 [kube-node] c01 [etcd] c01 [ovn-central] c01 [ovn-controller] c01 [virtlet] c01 [k8s-cluster:children] kube-node kube-master ``` Do the same for the cluster-102 with c01 and IP address 10.10.10.5. Create the ssh secret for Baremetal or VM based on your deployment. and Launch the kubernetes job as follows ``` $ kubectl create secret generic ssh-key-secret --from-file=id_rsa=/root/.ssh/id_rsa --from-file=id_rsa.pub=/root/.ssh/id_rsa.pub $ CLUSTER_NAME=cluster-101 $ cat <