|
| 1 | +--- |
| 2 | +title: Getting Started |
| 3 | +weight: 10 |
| 4 | +aliases: /ramendr-starter-kit/getting-started/ |
| 5 | +--- |
| 6 | + |
| 7 | +:toc: |
| 8 | +:imagesdir: /images |
| 9 | +:_content-type: ASSEMBLY |
| 10 | +include::modules/comm-attributes.adoc[] |
| 11 | + |
| 12 | +[id="deploying-ramendr-starter-kit-pattern"] |
| 13 | +== Deploying the RamenDR Starter Kit Pattern |
| 14 | + |
| 15 | +.Prerequisites |
| 16 | + |
| 17 | +* An OpenShift cluster |
| 18 | + ** To create an OpenShift cluster, go to the https://console.redhat.com/[Red Hat Hybrid Cloud console]. |
| 19 | + ** Select *OpenShift \-> Red Hat OpenShift Container Platform \-> Create cluster*. |
| 20 | +* A GitHub account with a personal access token that has repository read and write permissions. |
| 21 | +* The Helm binary, for instructions, see link:https://helm.sh/docs/intro/install/[Installing Helm] |
| 22 | +* Additional installation tool dependencies. For details, see link:https://validatedpatterns.io/learn/quickstart/[Patterns quick start]. |
| 23 | + |
| 24 | +It is desirable to have a cluster for deploying the GitOps management hub assets and a separate cluster(s) for the managed cluster(s). |
| 25 | + |
| 26 | +[id="preparing-for-deployment"] |
| 27 | +== Preparing for deployment |
| 28 | +.Procedure |
| 29 | + |
| 30 | +. Fork the link:https://github.com/validatedpatterns-sandbox/ramendr-starter-kit[ramendr-starter-kit] repository on GitHub. You must fork the repository because your fork is updated as part of the GitOps and DevOps processes. |
| 31 | + |
| 32 | +. Clone the forked copy of this repository. |
| 33 | ++ |
| 34 | +[source,terminal] |
| 35 | +---- |
| 36 | +$ git clone [email protected]:your-username/ramendr-starter-kit.git |
| 37 | +---- |
| 38 | + |
| 39 | +. Go to your repository: Ensure you are in the root directory of your Git repository by using: |
| 40 | ++ |
| 41 | +[source,terminal] |
| 42 | +---- |
| 43 | +$ cd /path/to/your/repository |
| 44 | +---- |
| 45 | + |
| 46 | +. Run the following command to set the upstream repository: |
| 47 | ++ |
| 48 | +[source,terminal] |
| 49 | +---- |
| 50 | +$ git remote add -f upstream [email protected]:validatedpatterns/ramendr-starter-kit.git |
| 51 | +---- |
| 52 | + |
| 53 | +. Verify the setup of your remote repositories by running the following command: |
| 54 | ++ |
| 55 | +[source,terminal] |
| 56 | +---- |
| 57 | +$ git remote -v |
| 58 | +---- |
| 59 | ++ |
| 60 | +.Example output |
| 61 | ++ |
| 62 | +[source,terminal] |
| 63 | +---- |
| 64 | +origin [email protected]:kquinn1204/ramendr-starter-kit.git (fetch) |
| 65 | +origin [email protected]:kquinn1204/ramendr-starter-kit.git (push) |
| 66 | +upstream [email protected]:validatedpatterns-sandbox/ramendr-starter-kit.git (fetch) |
| 67 | +upstream [email protected]:validatedpatterns-sandbox/ramendr-starter-kit.git (push) |
| 68 | +---- |
| 69 | + |
| 70 | +. Make a local copy of secrets template outside of your repository to hold credentials for the pattern. |
| 71 | ++ |
| 72 | +[WARNING] |
| 73 | +==== |
| 74 | +Do not add, commit, or push this file to your repository. Doing so may expose personal credentials to GitHub. |
| 75 | +==== |
| 76 | ++ |
| 77 | +Run the following commands: |
| 78 | ++ |
| 79 | +[source,terminal] |
| 80 | +---- |
| 81 | +$ cp values-secret.yaml.template ~/values-secret.yaml |
| 82 | +---- |
| 83 | + |
| 84 | +. Populate this file with secrets, or credentials, that are needed to deploy the pattern successfully: |
| 85 | ++ |
| 86 | +[source,terminal] |
| 87 | +---- |
| 88 | +$ vi ~/values-secret.yaml |
| 89 | +---- |
| 90 | + |
| 91 | +.. Edit the `vm-ssh` section to include the username, private key, and public key. To ensure the seamless flow of the pattern, the value associated with the `privatekey` and `publickey` has been updated with `path`. For example: |
| 92 | ++ |
| 93 | +[source,yaml] |
| 94 | +---- |
| 95 | + - name: vm-ssh |
| 96 | + vaultPrefixes: |
| 97 | + - global |
| 98 | + fields: |
| 99 | + - name: username |
| 100 | + value: 'cloud-user' |
| 101 | + - name: privatekey |
| 102 | + path: '/path/to/private-ssh-key' |
| 103 | + - name: publickey |
| 104 | + path: '/path/to/public-ssh-key' |
| 105 | +---- |
| 106 | ++ |
| 107 | +Paste the path to your locally stored private and public keys. If you do not have a key pair, generate one using `ssh-keygen`. |
| 108 | + |
| 109 | +.. Edit the `cloud-init` section to include the `userData` block to use with cloud-init. For example: |
| 110 | ++ |
| 111 | +[source,yaml] |
| 112 | +---- |
| 113 | + - name: cloud-init |
| 114 | + vaultPrefixes: |
| 115 | + - global |
| 116 | + fields: |
| 117 | + - name: userData |
| 118 | + value: |- |
| 119 | + #cloud-config |
| 120 | + user: 'cloud-user' |
| 121 | + password: 'cloud-user' |
| 122 | + chpasswd: { expire: False } |
| 123 | +---- |
| 124 | + |
| 125 | +.. Edit the `aws` section to refer to the file containing your AWS credentials: |
| 126 | ++ |
| 127 | +[source,yaml] |
| 128 | +---- |
| 129 | + - name: aws |
| 130 | + fields: |
| 131 | + - name: aws_access_key_id |
| 132 | + ini_file: ~/.aws/credentials |
| 133 | + ini_key: aws_access_key_id |
| 134 | + - name: aws_secret_access_key |
| 135 | + ini_file: ~/.aws/credentials |
| 136 | + ini_key: aws_secret_access_key |
| 137 | + - name: baseDomain |
| 138 | + value: aws.example.com |
| 139 | + - name: pullSecret |
| 140 | + path: ~/pull_secret.json |
| 141 | + - name: ssh-privatekey |
| 142 | + path: ~/.ssh/privatekey |
| 143 | + - name: ssh-publickey |
| 144 | + path: ~/.ssh/publickey |
| 145 | +---- |
| 146 | + |
| 147 | +.. Edit the `openshiftPullSecret` section to refer to the file containing your OpenShift pull secret: |
| 148 | ++ |
| 149 | +[source,yaml] |
| 150 | +---- |
| 151 | + - name: openshiftPullSecret |
| 152 | + fields: |
| 153 | + - name: .dockerconfigjson |
| 154 | + path: ~/pull_secret.json |
| 155 | +---- |
| 156 | + |
| 157 | +. Create and switch to a new branch named `my-branch`, by running the following command: |
| 158 | ++ |
| 159 | +[source,terminal] |
| 160 | +---- |
| 161 | +$ git checkout -b my-branch |
| 162 | +---- |
| 163 | + |
| 164 | +. If you made any changes to files tracked by git, git add them and then commit the changes by running the following command: |
| 165 | ++ |
| 166 | +[source,terminal] |
| 167 | +---- |
| 168 | +$ git commit -m "any updates" |
| 169 | +---- |
| 170 | + |
| 171 | +. Push the changes to your forked repository: |
| 172 | ++ |
| 173 | +[source,terminal] |
| 174 | +---- |
| 175 | +$ git push origin my-branch |
| 176 | +---- |
| 177 | + |
| 178 | +The preferred way to install this pattern is by using the script `./pattern.sh` script. |
| 179 | + |
| 180 | +[id="deploying-cluster-using-patternsh-file"] |
| 181 | +== Deploying the pattern by using the pattern.sh file |
| 182 | + |
| 183 | +To deploy the pattern by using the `pattern.sh` file, complete the following steps: |
| 184 | + |
| 185 | +. Log in to your cluster by following this procedure: |
| 186 | + |
| 187 | +.. Obtain an API token by visiting link:https://oauth-openshift.apps.<your-cluster>.<domain>/oauth/token/request[https://oauth-openshift.apps.<your-cluster>.<domain>/oauth/token/request]. |
| 188 | + |
| 189 | +.. Log in to the cluster by running the following command: |
| 190 | ++ |
| 191 | +[source,terminal] |
| 192 | +---- |
| 193 | +$ oc login --token=<retrieved-token> --server=https://api.<your-cluster>.<domain>:6443 |
| 194 | +---- |
| 195 | ++ |
| 196 | +Or log in by running the following command: |
| 197 | ++ |
| 198 | +[source,terminal] |
| 199 | +---- |
| 200 | +$ export KUBECONFIG=~/<path_to_kubeconfig> |
| 201 | +---- |
| 202 | + |
| 203 | +. Deploy the pattern to your cluster. Run the following command: |
| 204 | ++ |
| 205 | +[source,terminal] |
| 206 | +---- |
| 207 | +$ ./pattern.sh make install |
| 208 | +---- |
| 209 | + |
| 210 | +.Verification |
| 211 | + |
| 212 | +. Verify that the Operators have been installed on the hub cluster. Navigate to *Operators → Installed Operators* page in the OpenShift Container Platform web console on the Hub cluster (in the "local-cluster" view), |
| 213 | ++ |
| 214 | +.ramendr-starter-kit-operators |
| 215 | +image::/images/ramendr-starter-kit/ramendr-hub-operators.png[ramendr-starter-kit-operators,title="RamenDR Hub Operators"] |
| 216 | + |
| 217 | + |
| 218 | +. Verify that the primary and secondary managed clusters have been built. This can take close to an hour on AWS. On the hub cluster, navigate to *All Clusters* in the OpenShift Container Plaform web console: |
| 219 | ++ |
| 220 | +.ramendr-starter-kit-clusters |
| 221 | +image::/images/ramendr-starter-kit/ramendr-clusters-built.png[ramendr-starter-kit-operators,title="RamenDR Clusters"] |
| 222 | +. Wait some time for everything to deploy to all the clusters. It might take up to another hour from when the managed clusters finish building. You can track the progress through the `Hub ArgoCD` UI from the nines menu, especially the "opp-policy" and the "regional-dr" applications. Most of the critical resources are in the regional-dr application (at present, the opp-policy app may show missing/out-of-sync, and the regional-dr app may show OutOfSync - even when both are healthy. We are working on a fix, track bug progress link:https://github.com/validatedpatterns-sandbox/ramendr-starter-kit/issues/4[here]): |
| 223 | ++ |
| 224 | +.ramendr-starter-kit-operators-applications |
| 225 | +image::/images/ramendr-starter-kit/ramendr-starter-kit-hub-applications.png[ramendr-starter-kit-hub-applications,title="RamenDR Starter Kit Applications"] |
| 226 | +. Eventually, the Virtual Machines will be deployed and the Disaster Recovery Placement Control (DRPC) will show that resources are now protected. This screen can be reached via *All Clusters → Data Services → Disaster Recovery → Protected Applications* on the hub cluster. Normally it will be faster to synchronize Kubernetes objects than Application volumes. When these indicators both show Healthy it is safe to trigger a failover: |
| 227 | ++ |
| 228 | +.ramendr-starter-kit-trigger-failover |
| 229 | +image::/images/ramendr-starter-kit/ramendr-starter-kit-trigger-failover-1.png[ramendr-starter-kit-trigger-failover-1,title="RamenDR Starter Kit Trigger Failover, part 1"] |
| 230 | +. Clicking the "Failover" option will bring up a modal dialog that indicates where the failover will move the workload, and when the last known good state of the workload is. Click on the "Initiate" button to begin the failover: |
| 231 | ++ |
| 232 | +.ramendr-starter-kit-trigger-failover-part-2 |
| 233 | +image::/images/ramendr-starter-kit/ramendr-starter-kit-trigger-failover-2.png[ramendr-starter-kit-trigger-failover-2,title="RamenDR Starter Kit Trigger Failover, part 2"] |
| 234 | +. While the failover is happening, you can watch the progress of it in the activity area. When it is done, it will say (with a discovered application) that it is necessary to clean up application resources to allow replication to start in the other direction. Notice that the primary cluster should have changed: |
| 235 | ++ |
| 236 | +.ramendr-starter-kit-trigger-failover-cleanup |
| 237 | +image::/images/ramendr-starter-kit/ramendr-starter-kit-failover-cleanup.png[ramendr-starter-kit-failover-cleanup,title="RamenDR Starter Kit Failover Cleanup"] |
| 238 | +. The pattern provides a script to do this cleanup. Invoke it with your Hub cluster KUBECONFIG set and running `./pattern.sh scripts/cleanup-gitops-vms-non-primary.sh`: |
| 239 | ++ |
| 240 | +.ramendr-starter-kit-failover-cleanup-script |
| 241 | +image::/images/ramendr-starter-kit/ramendr-starter-kit-failover-cleanup-script.png[ramendr-starter-kit-failover-cleanup-script,title="RamenDR Starter Kit Failover Cleanup"] |
| 242 | +. After a few minutes, the resources should show healthy and protected again (the PVCs take a few minutes to synchronize): |
| 243 | ++ |
| 244 | +.ramendr-starter-kit-failover-reprotected |
| 245 | +image::/images/ramendr-starter-kit/ramendr-starter-kit-failover-reprotected.png[ramendr-starter-kit-failover-cleanup-reprotected,title="RamenDR Starter Kit Reprotected"] |
0 commit comments