Creating subscription-based sample application

To test failover from the Primary-managed cluster to the Secondary-managed cluster and relocate, use the following sample application.

Before you begin

  • Ensure that the Red Hat OpenShift GitOps operator is installed on the Hub cluster. For instructions, see RHACM documentation.
  • When creating an application for general consumption, ensure that the application is deployed to only one cluster.
  • Use the sample application called busybox as an example.
  • Ensure that all external routes of the application are configured by using either Global Traffic Manager (GTM) or Global Server Load Balancing (GLSB) service, for traffic redirection when the application fails over or is relocated.
  • As a best practice, group Red Hat Advanced Cluster Management (RHACM) subscriptions that belong together to refer to a single Placement Rule to DR protect them as a group. Further create them as a single application for a logical grouping of the subscriptions for future DR actions like failover and relocate.
    Note: If unrelated Subscriptions point to the same PlacementRule for placement actions, they will also be DR protected as the DR workflow controls all Subscriptions that point to a PlacementRule.

Procedure

  1. On the Hub cluster, navigate to Applications > Create application .
  2. Select type as Subscription.
  3. Enter your application Name (for example, busybox) and Namespace (for example, busybox-sample).
  4. In the Repository location for resources section, select Repository type Git.
  5. Enter the Git repository URL for the sample application, the GitHub Branch, and Path where the resources busybox Pod and PVC will be created.
    Use the sample application repository as https://github.com/red-hat-storage/ocm-ramen-samples, where the Branch is release-4.14 and Path is busybox-odr-metro.
  6. Scroll down in the form until you see Deploy application resources on clusters with all specified labels.
    • Select the global Cluster sets or the one that includes the correct managed clusters for your environment.
    • Add a label <name> with its value set to the managed cluster name.
  7. Click Create which is at the upper right hand corner.
    On the follow-on screen go to the Topology tab. There you can see all green checkmarks on the application topology.
    Note: To get more information, click any of the topology elements and a window will appear on the right of the topology view.
  8. Validate the sample application deployment.

    After the busybox application has been deployed to your preferred Cluster, the deployment can be validated.

    Login to your managed cluster where busybox was deployed by using RHACM.
    oc get pods,pvc -n busybox-sample
    Example output:
    NAME                          READY   STATUS    RESTARTS   AGE
    pod/busybox-67bf494b9-zl5tr   1/1     Running   0          77s
    
    
    NAME                                STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS                AGE
    persistentvolumeclaim/busybox-pvc   Bound    pvc-c732e5fe-daaf-4c4d-99dd-462e04c18412   5Gi        RWO            ocs-storagecluster-ceph-rbd   77s