Install the Cloud Native Toolkit on an existing cluster using GitOps
This is a work in progress, come back for updates.
Steps to install the Cloud-Native Toolkit in an existing OpenShift cluster using a declarative approach with ArgoCD.
Pre-requisites
The following is required before proceeding to the next section.
- Provision an OpenShift cluster.
- Install the
oc
andgit
cli. - Install the Cloud Native Toolkit CLI.
Installation
Fork the multi-tenancy-gitops repository and clone your fork.
git clone git@github.com:{gitorg}/multi-tenancy-gitops.gitcd multi-tenancy-gitopsUpdate the cloned repository with your GitHub Organization.
- Search and replace all instances of
github.com/cloud-native-toolkit/multi-tenancy-gitops.git
withgithub.com/{gitorg}/multi-tenancy-gitops.git
. - Commit and push your changes to your fork.git commit -m "Update github organization"git push origin master
- The gitops repository is structured into different layers (ie.
1-apps
,2-services
,3-infra
). Each layer is structured in a similar pattern consisting of the following:
The
argocd
folder contains a set of ArgoCD Application YAMLs.The set of folder(s) in each layer contains the resource YAMLs which will be deployed.
tree . -L 2.├── 0-bootstrap│ └── argocd├── 1-apps│ ├── argocd│ └── instances├── 2-services│ ├── argocdEach
argocd
folder contains anactive
andinactive
sub-folder. For each layer, select the ArgoCD Appliation YAMLs to deploy and move them into theactive
folder.1-apps/argocd/├── active└── inactive2-services/argocd/├── active└── inactive3-infra/argocd/Commit and push your changes to your fork.
git commit -m "Update github organization"git push origin master
- Install the Red Hat OpenShift GitOps operator using the commands below or directly from the OpenShift Web Console. An instance of ArgoCD will automatically be created in the
openshift-gitops
namespace.oc apply -f 2-services/operators/openshift-gitops/ -n openshift-operators
Verify you can log on to the ArgoCD Web Console.
# ArgoCD Web Console URLecho https://$(oc get route argocd-cluster-server -o jsonpath='{ .spec.host }' -n openshift-gitops)# Admin passwordoc extract secret/argocd-cluster-cluster --to=- -n openshift-gitops
Review and apply the custom ClusterRole permissions to the ArgoCD Application Controller service account. This is required for ArgoCD to create the required Kubernetes resources in target namespaces.
oc apply -f 3-infra/clusterrole/Create the bootstrap ArgoCD application.
The bootstrap application will create the parent ArgoCD Application for each layer (YAMLs are located in
0-bootstrap
folder). The parent ArgoCD Applications will subsequently create the ArgoCD Applications in the/argocd/active
directory.Depending on what resources have been selected, it will take some time for the ArgoCD to deploy the resources.
oc apply -f bootstrap.yaml -n openshift-gitopsFrom the OpenShift Web Console, verify the resources (ie, operators, namespaces, etc) have been successfully created and/or deployed.