1 # Multi cluster installation
5 Multi Cluster installation is an important features for production deployments.
7 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
9 This section explains how to deploy the Multi cluster of Kubernetes from a containerized KUD running as a Kubernetes Job.
13 KUD installation installer is divided into two regions with args - `--install-pkg` and `--cluster <cluster-name>`
16 **--install-pkg** - Installs packages required to run installer script itself inside a container and kubespray packages
18 **--cluster < cluster-name >** - Installs k8s cluster, addons and plugins and store the artifacts in the host machine
20 ### Internal Mechanism
22 * Container image is build using the `installer --install-pkg` arg and Kubernetes job is used to install the cluster using `installer --cluster <cluster-name>`. Installer will invoke the kubespray cluster.yml, kud-addsons and plugins ansible cluster.
24 Installer script finds the `hosts.init` for each cluster in `/opt/multi-cluster/<cluster-name>`
26 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/<cluster-name>/logs` and artifacts are stored as follows `/opt/kud/multi-cluster/<cluster-name>/artifacts`
28 ## Quickstart Installation Guide
30 Build the kud docker images as follows:
33 $ git clone https://github.com/onap/multicloud-k8s.git && cd multicloud-k8s
35 --build-arg http_proxy=${http_proxy} \
36 --build-arg HTTP_PROXY=${HTTP_PROXY} \
37 --build-arg https_proxy=${https_proxy} \
38 --build-arg HTTPS_PROXY=${HTTPS_PROXY} \
39 --build-arg no_proxy=${no_proxy} \
40 --build-arg NO_PROXY=${NO_PROXY} \
41 -t github.com/onap/multicloud-k8s:latest . -f build/Dockerfile
43 Let's create a cluster-101 and cluster-102 hosts.ini as follows
46 $ mkdir -p /opt/kud/multi-cluster/{cluster-101,cluster-102}
49 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)
52 /opt/kud/multi-cluster/cluster-101/hosts.ini
54 c01 ansible_ssh_host=10.10.10.5 ansible_ssh_port=22
74 [k8s-cluster:children]
78 Do the same for the cluster-102 with c01 and IP address 10.10.10.5.
80 Create the ssh secret for Baremetal or VM based on your deployment. and Launch the kubernetes job as follows
82 $ 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
83 $ CLUSTER_NAME=cluster-101
84 $ cat <<EOF | kubectl create -f -
88 name: kud-$CLUSTER_NAME
95 image: github.com/onap/multicloud-k8s:latest
96 imagePullPolicy: IfNotPresent
99 mountPath: /opt/kud/multi-cluster
100 - name: secret-volume
102 command: ["/bin/sh","-c"]
103 args: ["cp -r /.ssh /root/; chmod -R 600 /root/.ssh; ./installer --cluster $CLUSTER_NAME"]
107 - name: multi-cluster
109 path: /opt/kud/multi-cluster
110 - name: secret-volume
112 secretName: ssh-key-secret
119 Multi - cluster information from the host machine;
122 $ kubectl --kubeconfig=/opt/kud/multi-cluster/cluster-101/artifacts/admin.conf cluster-info
123 Kubernetes master is running at https://192.168.121.2:6443
124 coredns is running at https://192.168.121.2:6443/api/v1/namespaces/kube-system/services/coredns:dns/proxy
125 kubernetes-dashboard is running at https://192.168.121.2:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy
127 To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
128 $ kubectl --kubeconfig=/opt/kud/multi-cluster/cluster-102/artifacts/admin.conf cluster-info
129 Kubernetes master is running at https://192.168.121.6:6443
130 coredns is running at https://192.168.121.6:6443/api/v1/namespaces/kube-system/services/coredns:dns/proxy
131 kubernetes-dashboard is running at https://192.168.121.6:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy
133 To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.