|
| 1 | +--- |
| 2 | +menu: |
| 3 | + learn: |
| 4 | + parent: Patterns quick start |
| 5 | +title: Getting Started with Multicloud GitOps |
| 6 | +aliases: /infrastructure/using-validated-pattern-operator/ |
| 7 | +weight: 20 |
| 8 | +--- |
| 9 | + |
| 10 | +:toc: |
| 11 | +:imagesdir: /images |
| 12 | +:_content-type: ASSEMBLY |
| 13 | +include::modules/comm-attributes.adoc[] |
| 14 | + |
| 15 | +== Getting Started with Multicloud GitOps |
| 16 | + |
| 17 | +Multicloud GitOps is a foundational pattern that demonstrates GitOps principles for managing applications across multiple clusters. It provides: |
| 18 | + |
| 19 | +* A GitOps framework using ArgoCD |
| 20 | +* Infrastructure-as-Code practices |
| 21 | +* Multi-cluster management capabilities |
| 22 | +* Template for secure secret management |
| 23 | + |
| 24 | +The Multicloud GitOps pattern is recommended as your first pattern because: |
| 25 | + |
| 26 | +. It establishes core GitOps practices |
| 27 | +. Provides a minimal but complete implementation |
| 28 | +. Serves as a foundation for other patterns |
| 29 | +. Demonstrates key validated patterns concepts |
| 30 | + |
| 31 | +[NOTE] |
| 32 | +==== |
| 33 | +Other patterns build upon these concepts, making this an ideal starting point for your validated patterns journey. |
| 34 | +==== |
| 35 | + |
| 36 | +== Deploying the Multicloud GitOps pattern |
| 37 | + |
| 38 | +.Prerequisites |
| 39 | + |
| 40 | +* An OpenShift cluster |
| 41 | + ** To create an OpenShift cluster, go to the https://console.redhat.com/[Red Hat Hybrid Cloud console]. |
| 42 | + ** Select *Services \-> Containers \-> Create cluster*. |
| 43 | + ** The cluster must have a dynamic `StorageClass` to provision `PersistentVolumes`. Verify that a dynamic `StorageClass` exists before creating one by running the following command: |
| 44 | ++ |
| 45 | +[source,terminal] |
| 46 | +---- |
| 47 | +oc get storageclass -o custom-columns=NAME:.metadata.name,PROVISIONER:.provisioner,DEFAULT:.metadata.annotations."storageclass\.kubernetes\.io/is-default-class" |
| 48 | +---- |
| 49 | ++ |
| 50 | +* Optional: A second OpenShift cluster for multicloud demonstration. |
| 51 | +//Replaced git and podman prereqs with the tooling dependencies page |
| 52 | +* https://validatedpatterns.io/learn/quickstart/[Install the tooling dependencies]. |
| 53 | + |
| 54 | +The use of this pattern depends on having at least one running Red Hat OpenShift cluster. However, consider creating a cluster for deploying the GitOps management hub assets and a separate cluster for the managed cluster. |
| 55 | + |
| 56 | +If you do not have a running Red Hat OpenShift cluster, you can start one on a |
| 57 | +public or private cloud by using https://console.redhat.com/openshift/create[Red Hat Hybrid Cloud Console]. |
| 58 | + |
| 59 | +.Procedure |
| 60 | + |
| 61 | +. Fork the https://github.com/validatedpatterns/multicloud-gitops[multicloud-gitops] repository on GitHub. |
| 62 | +. Clone the forked copy of this repository. |
| 63 | ++ |
| 64 | +[source,terminal] |
| 65 | +---- |
| 66 | +$ git clone [email protected]:your-username/multicloud-gitops.git |
| 67 | +---- |
| 68 | + |
| 69 | +. Create a local copy of the secret values file that can safely include credentials. Run the following commands: |
| 70 | ++ |
| 71 | +[source,terminal] |
| 72 | +---- |
| 73 | +$ cp values-secret.yaml.template ~/values-secret-multicloud-gitops.yaml |
| 74 | +---- |
| 75 | ++ |
| 76 | +[source,terminal] |
| 77 | +---- |
| 78 | +$ vi ~/values-secret-multicloud-gitops.yaml |
| 79 | +---- |
| 80 | ++ |
| 81 | +[WARNING] |
| 82 | +==== |
| 83 | +Do not commit this file. You do not want to push personal credentials to GitHub. If you do not want to customize the secrets, these steps are not needed. The framework generates a random password for the `config-demo` application. |
| 84 | +==== |
| 85 | + |
| 86 | +. Customize the deployment for your cluster. Run the following command: |
| 87 | ++ |
| 88 | +[source,terminal] |
| 89 | +---- |
| 90 | +$ git checkout -b my-branch |
| 91 | +---- |
| 92 | ++ |
| 93 | +[source,terminal] |
| 94 | +---- |
| 95 | +$ vi values-global.yaml |
| 96 | +---- |
| 97 | ++ |
| 98 | +[source,terminal] |
| 99 | +---- |
| 100 | +$ git add values-global.yaml |
| 101 | +---- |
| 102 | ++ |
| 103 | +[source,terminal] |
| 104 | +---- |
| 105 | +$ git commit values-global.yaml |
| 106 | +---- |
| 107 | ++ |
| 108 | +[source,terminal] |
| 109 | +---- |
| 110 | +$ git push origin my-branch |
| 111 | +---- |
| 112 | + |
| 113 | +You can install the Multicloud GitOps pattern by using the web console or from command line. |
| 114 | + |
| 115 | +To install the Multicloud GitOps pattern by using the the web console you must first install the Validated Patterns Operator. The Validated Patterns Operator installs and manages Validated Patterns. |
| 116 | + |
| 117 | +//Include Procedure module here |
| 118 | +[id="installing-validated-patterns-operator_{context}"] |
| 119 | +== Installing the {validated-patterns-op} |
| 120 | + |
| 121 | +.Prerequisites |
| 122 | +* Access to an {ocp} cluster using an account with cluster-admin permissions. |
| 123 | + |
| 124 | +.Procedure |
| 125 | + |
| 126 | +. Navigate in the {hybrid-console-first} to the *Operators* → *OperatorHub* page. |
| 127 | + |
| 128 | +. Scroll or type a keyword into the *Filter by keyword* box to find the Operator you want. For example, type `validated patterns` to find the {validated-patterns-op}. |
| 129 | + |
| 130 | +. Select the Operator to display additional information. |
| 131 | ++ |
| 132 | +[NOTE] |
| 133 | +==== |
| 134 | +Choosing a Community Operator warns that Red Hat does not certify Community Operators; you must acknowledge the warning before continuing. |
| 135 | +==== |
| 136 | + |
| 137 | +. Read the information about the Operator and click *Install*. |
| 138 | + |
| 139 | +. On the *Install Operator* page: |
| 140 | + |
| 141 | +.. Select an *Update channel* (if more than one is available). |
| 142 | + |
| 143 | +.. Select a *Version* (if more than one is available). |
| 144 | + |
| 145 | +.. Select an *Installation mode*: |
| 146 | +*** *All namespaces on the cluster (default)* installs the Operator in the default `openshift-operators` namespace to watch and be made available to all namespaces in the cluster. This option is not always available. |
| 147 | +*** *A specific namespace on the cluster* allows you to choose a specific, single namespace in which to install the Operator. The Operator will only watch and be made available for use in this single namespace. |
| 148 | + |
| 149 | +.. Select *Automatic* or *Manual* approval strategy. |
| 150 | + |
| 151 | +. Click *Install* to make the Operator available to the selected namespaces on this {ocp} cluster. |
| 152 | + |
| 153 | +.Verification |
| 154 | +To confirm that the installation is successful: |
| 155 | + |
| 156 | +. Navigate to the *Operators* → *Installed Operators* page. |
| 157 | + |
| 158 | +. Check that the Operator is installed in the selected namespace and its status is `Succeeded`. |
| 159 | + |
| 160 | +//Include Procedure module here |
| 161 | +[id="create-pattern-instance_{context}"] |
| 162 | +== Creating the Multicloud GitOps instance |
| 163 | + |
| 164 | +.Prerequisites |
| 165 | +The {validated-patterns-op} is successfully installed in the relevant namespace. |
| 166 | + |
| 167 | +.Procedure |
| 168 | + |
| 169 | +. Navigate to the *Operators* → *Installed Operators* page. |
| 170 | + |
| 171 | +. Click the installed *{validated-patterns-op}*. |
| 172 | + |
| 173 | +. Under the *Details* tab, in the *Provided APIs* section, in the |
| 174 | +*Pattern* box, click *Create Instance* that displays the *Create Pattern* page. |
| 175 | + |
| 176 | +. On the the *Create Pattern* page, select *Form view* and enter information in the following fields: |
| 177 | + |
| 178 | +** *Name* - A name for the pattern deployment that is used in the projects that you created. |
| 179 | +** *Labels* - Apply any other labels you might need for deploying this pattern. |
| 180 | +** *Cluster Group Name* - Select a cluster group name to identify the type of cluster where this pattern is being deployed. For example, if you are deploying the {ie-pattern}, the cluster group name is `datacenter`. If you are deploying the {mcg-pattern}, the cluster group name is `hub`. |
| 181 | ++ |
| 182 | +To know the cluster group name for the patterns that you want to deploy, check the relevant pattern-specific requirements. |
| 183 | +. Expand the *Git Config* section to reveal the options and enter the required information. |
| 184 | +. Leave *In Cluster Git Server* unchanged. |
| 185 | +.. Change the *Target Repo* URL to your forked repository URL. For example, change `+https://github.com/validatedpatterns/<pattern_name>+` to `+https://github.com/<your-git-username>/<pattern-name>+` |
| 186 | +.. Optional: You might need to change the *Target Revision* field. The default value is `HEAD`. However, you can also provide a value for a branch, tag, or commit that you want to deploy. For example, `v2.1`, `main`, or a branch that you created, `my-branch`. |
| 187 | +. Ensure that you have made any required changes to your `values-*.yaml` files locally and pushed them to your forked repository on the correct branch or target that you chose in the previous step. |
| 188 | +. Click *Create*. |
| 189 | + |
| 190 | +.Verification |
| 191 | + |
| 192 | +The {rh-gitops} Operator displays in list of *Installed Operators*. The {rh-gitops} Operator installs the remaining assets and artifacts for this pattern. To view the installation of these assets and artifacts, such as {rh-rhacm-first}, ensure that you switch to *Project:All Projects*. |
| 193 | + |
| 194 | +For more information about post-installation instructions for a pattern, see its _Getting started_ page. |
| 195 | + |
| 196 | + |
| 197 | +. Deploy the pattern by running `./pattern.sh make install` or by using the link:/infrastructure/using-validated-pattern-operator/[Validated Patterns Operator]. |
| 198 | + |
| 199 | +[id="deploying-cluster-using-patternsh-file"] |
| 200 | +== Deploying the cluster by using the pattern.sh file |
| 201 | + |
| 202 | +To deploy the cluster by using the `pattern.sh` file, complete the following steps: |
| 203 | + |
| 204 | +. Login to your cluster by running the following command: |
| 205 | ++ |
| 206 | +[source,terminal] |
| 207 | +---- |
| 208 | + oc login |
| 209 | +---- |
| 210 | ++ |
| 211 | +Optional: Set the `KUBECONFIG` variable for the `kubeconfig` file path: |
| 212 | ++ |
| 213 | +[source,terminal] |
| 214 | +---- |
| 215 | + export KUBECONFIG=~/<path_to_kubeconfig> |
| 216 | +---- |
| 217 | + |
| 218 | +. Deploy the pattern to your cluster. Run the following command: |
| 219 | ++ |
| 220 | +[source,terminal] |
| 221 | +---- |
| 222 | + ./pattern.sh make install |
| 223 | +---- |
| 224 | + |
| 225 | +. Verify that the Operators have been installed. |
| 226 | + .. To verify, in the OpenShift Container Platform web console, navigate to *Operators → Installed Operators* page. |
| 227 | + .. Check that the Operator is installed in the `openshift-operators` namespace and its status is `Succeeded`. |
| 228 | +. Verify that all applications are synchronized. Under the project `multicloud-gitops-hub` click the URL for the `hub` gitops `server`. The Vault application is not synched. |
| 229 | ++ |
| 230 | +image::multicloud-gitops/multicloud-gitops-argocd.png[Multicloud GitOps Hub] |
| 231 | + |
| 232 | + |
| 233 | +As part of this pattern, HashiCorp Vault has been installed. Refer to the section on https://validatedpatterns.io/secrets/vault/[Vault]. |
| 234 | + |
| 235 | + |
| 236 | +You can use the {validated-patterns-op} to install and manage {solution-name-upstream}. Use the {hybrid-console-first} to install the {validated-patterns-op}. After installing the Operator, you can create an instance where you can specify the details for your pattern. The {validated-patterns-op} then installs and manages the required assets and artifacts that the pattern requires. |
| 237 | + |
| 238 | + |
0 commit comments