# RHACM - OpenShift Virtualization notes ## Deploy RHACM on AWS Will Create Notes when i have time I used [AWS Blank Open Environment](https://demo.redhat.com/catalog?item=babylon-catalog-test/sandboxes-gpte.sandbox-open.test&utm_source=webapp&utm_medium=share-link) and built it from scratch. May need to use rosa? Quick Steps ``` curl -OL https://gist.githubusercontent.com/tosin2013/76e47de3f32de4486ab4699c21b2188e/raw/959ae5dd2117edf124e4531cfae5216c722a3358/openshift-ai-workload.sh # optional change .compute[0].replicas to 3 vim openshift-ai-workload.sh chmod +x openshift-ai-workload.sh export aws_access_key_id="YOUR_ACCESS_KEY_ID" export aws_secret_access_key="YOUR_SECRET_ACCESS_KEY" export aws_region="YOUR_AWS_REGION" ./openshift-ai-workload.sh m6i.2xlarge ``` Configure SSL Certs ``` export KUBECONFIG=/home/lab-user/cluster/auth/kubeconfi curl -OL https://gist.githubusercontent.com/tosin2013/866522a1420ac22f477d2253121b4416/raw/35d6fa88675d63b6ecf58a827df32356ccf3ddde/configure-keys-on-openshift.sh chmod +x configure-keys-on-openshift.sh configure-keys-on-openshift.sh ./configure-keys-on-openshift.sh <AWS_ACCESS_KEY> <AWS_SECRET_ACCESS_KEY> podman ``` Configure RHACM ``` git clone https://github.com/tosin2013/sno-quickstarts.git cd sno-quickstarts/gitops ./deploy.sh oc apply -f apps/acm-gitops-deployment/cluster-config.yaml ``` # Deploy one or more OpenShift Clusters on Equinix Metal baremetal * [Equinix Metal baremetal ](https://demo.redhat.com/catalog?item=babylon-catalog-prod/equinix-metal.eqx-blank.prod&utm_source=webapp&utm_medium=share-link) * [Step 1](https://tosin2013.github.io/qubinode_navigator/deployments/setup-sh.html) * [Step 2](https://tosin2013.github.io/qubinode_navigator/plugins/onedev.html) * [Step 3](https://tosin2013.github.io/qubinode_navigator/plugins/onedev-kcli-openshift4-baremetal-external.html) ## Configure SSL certs on baremetal servers ``` sudo su - oc login --token=sha256~token-token --server=https://api.lab.GUID.sandboxXXX.opentlc.com:6443 curl -OL https://gist.githubusercontent.com/tosin2013/866522a1420ac22f477d2253121b4416/raw/35d6fa88675d63b6ecf58a827df32356ccf3ddde/configure-keys-on-openshift.sh chmod +x configure-keys-on-openshift.sh ./configure-keys-on-openshift.sh <AWS_ACCESS_KEY> <AWS_SECRET_ACCESS_KEY> podman ``` ## Configure Enviornment for OpenShift Virtualization *To-Do automate it from RHACM* ``` oc login --token=sha256~token-token --server=https://api.lab.GUID.sandboxXXX.opentlc.com:6443 git clone https://github.com/tosin2013/sno-quickstarts.git cd sno-quickstarts/gitops ./configure-redhat-labs.sh --configure-infra-nodes --configure-storage # Exit menu patch the storage class and restart script # oc patch storageclass ocs-storagecluster-ceph-rbd -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' ``` ## Install OpenShift Virtualization *Select menu option `equinix-cnv-virtualization`* ``` ./configure-redhat-labs.sh ``` *Configure OpenShift image registry* ``` curl -OL https://raw.githubusercontent.com/tosin2013/openshift-4-deployment-notes/master/post-steps/configure-registry.sh chmod +x configure-registry.sh ./configure-registry.sh ``` ## Select equinix-cnv-virtualization when deployment is complete # RHACM Configuration ## Import Openshift Virtualization Clusters ![image](https://hackmd.io/_uploads/rkmc5cAbR.png) ## Preparing RHACM for ArgoCD Integration Run the commands on your RHACM Cluster ``` <hub> $ cat >> managedclusterset.yaml << EOF --- apiVersion: cluster.open-cluster-management.io/v1beta2 kind: ManagedClusterSet metadata: name: openshift-virt-clusters EOF <hub> $ oc apply -f managedclusterset.yaml ``` Now, import local-cluster into the ManagedClusterSet resource. Importation will be done by adding the cluster.open-cluster-management.io/clusterset: openshift-virt-clusters label to the OpensShift Virtulaization Clusters ManagedCluster resource - ``` <hub> $ oc edit managedcluster <cluster-guid> ... labels: ... cloud: BareMetal cluster.open-cluster-management.io/clusterset: openshift-virt-clusters ... ``` ![image](https://hackmd.io/_uploads/Sy0Vo90bA.png) Create the ManagedClusterSetBinding resource to bind the openshift virt clusters ManagedClusterSet resource to the openshift-gitops resource. Creating the ManagedClusterSetBinding resource will allow ArgoCD to access openshift virtualization clusters information and import it into its management stack. ``` <hub> $ cat >> managedclustersetbinding.yaml << EOF --- apiVersion: cluster.open-cluster-management.io/v1beta2 kind: ManagedClusterSetBinding metadata: name: openshift-virt-clusters namespace: openshift-gitops spec: clusterSet: openshift-virt-clusters EOF <hub> $ oc apply -f managedclustersetbinding.yaml ``` Create the Placement resource and bind it to openshift-virt-clusters ManagedClusterSet. Note that you will not be using any special filters in this exercise. ``` <hub> $ cat >> placement.yaml << EOF --- apiVersion: cluster.open-cluster-management.io/v1beta1 kind: Placement metadata: name: openshift-virt-clusters namespace: openshift-gitops spec: clusterSets: - openshift-virt-clusters EOF <hub> $ oc apply -f placement.yaml ``` Create the GitOpsServer resource to indicate the location of ArgoCD and the placement resource - ``` <hub> $ export CLUSTER_NAME="yourclustername" <hub> $ cat >> gitopsserver.yaml << EOF --- apiVersion: apps.open-cluster-management.io/v1beta1 kind: GitOpsCluster metadata: name: gitops-cluster-${CLUSTER_NAME} namespace: openshift-gitops spec: argoServer: cluster: ${CLUSTER_NAME} argoNamespace: openshift-gitops placementRef: kind: Placement apiVersion: cluster.open-cluster-management.io/v1alpha1 name: openshift-virt-clusters EOF <hub> $ cat gitopsserver.yaml <hub> $ oc apply -f gitopsserver.yaml ``` [Currently on ACM 2.10 with baremetal: GitopsCluster CR fails with secret cannot be found Please follow instuctions in link](https://access.redhat.com/solutions/7061577) if status is run the additional commands below ``` status: lastUpdateTime: '2024-04-30T17:30:24Z' message: secrets "mrw6d-cluster-secret" not found phase: failed ``` You should now see the clusters populate on Argocd ![image](https://hackmd.io/_uploads/S1N3jjRWR.png) ## Install Gitea on RHACM Cluster ``` curl -OL https://raw.githubusercontent.com/tosin2013/openshift-demos/master/quick-scripts/deploy-gitea.sh chmod +x deploy-gitea.sh ./deploy-gitea.sh ``` **Login To Gitea** ![image](https://hackmd.io/_uploads/SJo8AoRbC.png) **Create User** ![image](https://hackmd.io/_uploads/ByiCAsAWC.png) **Click on `New Migration:`** ![image](https://hackmd.io/_uploads/BJcOlhAWR.png) **Click on `Git`** ![image](https://hackmd.io/_uploads/ryClj00bC.png) **Migrate Git Repo** * https://github.com/tosin2013/kubevirt-gitops.git ![image](https://hackmd.io/_uploads/BkSdiCAbR.png) **Update Git URL** For demo-instance1 or for demo-instance2 if you deployed two clusters `clusters/overlays/rhpds-instance/demo-instance1/patch-application-repo-revision.yaml` * update line 3 with the gitea url * update the target cluster on line 9 ![image](https://hackmd.io/_uploads/HJ_O-4xGR.png) * update line 3 with your repo `clusters/overlays/rhpds-instance/demo-instance1/patch-applicationset-repo-revision.yaml` ![image](https://hackmd.io/_uploads/r1p1GVgzA.png) * update lines 5,11,17,23 under `components/argocd/apps/overlays/demo-instance1/patch-operators-list.yaml` ![image](https://hackmd.io/_uploads/HyQKIVgz0.png) ## Configure ArgoCD cluster ![image](https://hackmd.io/_uploads/r1GrhACW0.png) Login Information * Username: `admin` * Password: `under Secrets->openshift-gitops-cluster` ![image](https://hackmd.io/_uploads/HkNohAAWA.png) Connect to git repo ![image](https://hackmd.io/_uploads/S1FJee1z0.png) Login To RHACM via jumpbox Git Clone Gitea repo ``` git clone https://gitea-with-admin-gitea.apps.gitops.sandbox000.opentlc.com/user1/kubevirt-gitops.git cd kubevirt-gitops/ ``` For demo-instance1 ``` oc apply -k clusters/overlays/rhpds-instance/demo-instance1 kustomize build clusters/overlays/rhpds-instance/demo-instance1 ``` For demo-instance2 ``` oc apply -k clusters/overlays/rhpds-instance/demo-instance2 ``` ![image](https://hackmd.io/_uploads/rkcTHrZMR.png)