# How to prepare Git repos and Kubernetes cluster to work with Flux ## Pre-requirements In order to run the different scripts, an installer machine must be used. The recommended OS for the installer machine is Ubuntu24.04, but the installation might also work in other OS. Two empty Git repos are required and must be previously created to host the SW catalog and the fleet of clusters. Recommended names are `sw-catalogs-osm` and `fleet-osm`. A Git user with its credentials must be configured to have access to the repos via HTTP and SSH. That user will be used to populate the Git repos during this process, and will also be used by Flux to sync with the repos. ## Initial setup Clone OSM devops repo, which contains the installation scripts: ```bash git clone "https://osm.etsi.org/gitlab/osm/devops" cd devops git checkout "v18.0" git pull ``` Configure file `~/.osm/user-install-options.rc` with env variables for subsequent stages ```bash export KUBECONFIG_MGMT_CLUSTER=~/.kube/management-cluster-kubeconfig.yaml # export MGMT_CLUSTER_CA_FILE="/usr/local/share/ca-certificates/mycert.crt" ``` Configure the file `~/.osm/.credentials/git_environment.rc` with the Git credentials. An example can be seen below. ```bash export FLEET_REPO_HTTP_URL="http://git.10.95.134.156.nip.io/osm-developer/fleet-osm.git" export FLEET_REPO_SSH_URL="ssh://git@git.10.95.134.156.nip.io:2222/osm-developer/fleet-osm.git" export FLEET_REPO_GIT_USERNAME="osm-developer" export FLEET_REPO_GIT_USER_PASS='***' export SW_CATALOGS_REPO_HTTP_URL="http://git.10.95.134.156.nip.io/osm-developer/sw-catalogs-osm.git" export SW_CATALOGS_REPO_SSH_URL="ssh://git@git.10.95.134.156.nip.io:2222/osm-developer/sw-catalogs-osm.git" export SW_CATALOGS_REPO_GIT_USERNAME="osm-developer" export SW_CATALOGS_REPO_GIT_USER_PASS='***' ``` ## Install client tools It installs locally the following tools: kubectl, helm, curl, flux client, git, age, argo client. These tools will be used in the deployment of the management cluster. ```bash ./installers/10-install-client-tools.sh ``` ### Deploy management cluster This step is in charge of deploying Flux and the different CRDs/operators required to manage the lifecycle of the clusters (Crossplane, CAPI, etc.), in the management Kubernetes cluster. It also configures Flux to sync with the repos created in the previous stage and populates those repos with the initial content. ```bash ./installers/30-deploy-mgmt-cluster.sh ``` As a result, Git repos are initially populated. A copy of the repos can be found in under `~/.osm/repos`. Flux should be running in the management cluster, and repos and kustomizations should be visible. ```bash kubectl get gitrepo -A kubectl get ks -A ```