23.1.14. 2070 Create a Cluster with Named Machines

23.1.14.1. Overview

  • Id: 2070

  • Time: 15 Minutes

  • Enabled: Yes

  • Difficulty: intermediate

  • Tags: clusters, profiles, resource_brokers

  • Concepts: params, clusters

23.1.14.2. Objective

Learn how to define a cluster to enable specific control of which machines are present or to have machines in multiple roles

Use the more advanced machine naming capabilities of clusters, the User will create a cluster with customized machine names and roles.

Business ROI: Maintaining production clusters requires operators to maintain exact control of the lifecycle of all managed systems.

23.1.14.3. Prerequisites

Required Labs:

  • 2060

23.1.14.3.1. Summary

23.1.14.3.1.1. Create an empty cluster

  1. Navigate to Clusters

  2. Click Add

    Set Name to lab2070

    Set the broker/name to context-broker

    Set the cluster/count to 0

    With this is 0, the cluster logic will not allocate any machines. This gives us a chance to build a Parameter that defines the cluster.

    Click Save and wait for it to enter Work Order Mode

23.1.14.3.1.2. Create a named set of machines for the cluster

  1. Navigate to the lab2070 cluster’s Params tab

  2. Click Add Params and select cluster/machines

  3. Click Add Params and select cluster/machine-types

  4. Set the cluster/machines-types paramter value

    The default value is acceptable.

    [ "machine" ]
    
  5. Set the cluster/machines paramter value

    Set the value to:

    {
      "machine": {
          "names": [ "lab2070-red", "lab2070-green", "lab2070-blue" ]
      }
    }
    

    Click the little save icon

    Hover over the cluster/machines text to review the inline help for formatting

  6. Navigate to the Activity tab

  7. Click Apply to run the universal-application-base-cluster Work Order

    This Work Order reevaluates the parameters of the cluster to grow or shrink the cluster.

23.1.14.3.1.3. Observe the cluster being built

  1. Navigate to Machines

  2. Observe the named machines being created

    As the cluster builds, machines named lab2070-red, lab2070-green, and lab2070-blue will appear.

23.1.14.3.1.4. Create a named set of machines for the cluster

  1. Navigate to the lab2070 cluster’s Params tab

  2. Edit the cluster/machines paramter value

    Set the value to:

    {
      "machine": {
          "names": [ "lab2070-red", "lab2070-yellow", "lab2070-blue" ]
      }
    }
    

    Click the little save icon

  3. Navigate to the Activity tab

  4. Click Apply to run the universal-application-base-cluster Work Order

    This Work Order reevaluates the parameters of the cluster to grow or shrink the cluster.

23.1.14.3.1.5. Observer the cluster being updated

  1. Navigate to Machines

  2. Observe the named machines being created and removed

    As the cluster updates, the machine lab2070-green will be removed and the lab2070-yellow machine will be added.

23.1.14.3.1.6. Create a new class of named set of machines for the cluster

  1. Navigate to the lab2070 cluster’s Params tab

  2. Edit the cluster/machine-types paramter value

    Make the value look like this:

    [ "machine", "leader" ]
    
  3. Edit the cluster/machines paramter value

    Set the value to:

    {
      "machine": {
          "names": [ "lab2070-red", "lab2070-yellow", "lab2070-blue" ]
      },
      "leader": {
          "names": [ "lab2070-leader" ]
      }
    }
    

    Click the little save icon

  4. Navigate to the Activity tab

  5. Click Apply to run the universal-application-base-cluster Work Order

    This Work Order reevaluates the parameters of the cluster to grow or shrink the cluster.

23.1.14.3.1.7. Observer the cluster being updated to have a leader

  1. Navigate to Machines

  2. Observe the new leader named machine being created

    As the cluster updates, the machine lab2070-leader will be added.

23.1.14.3.1.8. Make a templatized set of named machines for a cluster

The named machines pattern is useful, but has “hard-coded” values for the names within the cluster. There are times when a template of machine names is useful. Part of the name should reflect the cluster name, but the rest of the name should follow the defined patterns.

This section will walk through creating a template profile.

  1. Navigate to Profiles

  2. Click Create

    Set ‘Name’ to template2070

    Click ‘Save’

  3. Click Add Params and add cluster/machine-types and cluster-machines

  4. Edit cluster/machine-types

    Set the value to:

    [ "machine",  "leader" ]
    

    Click the little save icon

  5. Edit cluster/machines

    Set the value to:

    {
      "leader": {
        "names": [
          "{{.Machine.Name}}-leader"
        ]
      },
      "machine": {
        "names": [
          "{{.Machine.Name}}-red",
          "{{.Machine.Name}}-green",
          "{{.Machine.Name}}-yellow"
        ]
      }
    }
    

    Click the little save icon

    The {{.Machine.Name}} is Golang template expansion markers that DRP uses to templatize a value. In this case, the cluster name is represented by {{.Machine.Name}}.

23.1.14.3.1.9. Create a couple of clusters using the template

  1. Navigate to Clusters

  2. Click Add

    Set Name to lab2070-t1

    Add the template profile, template2070, by clicking the + next to Configuration / Profiles

    Set the broker/name to context-broker

    Click Save

    cluster/count is ignored because the override by the template profile.

  3. Close the lab2070-t1 editor by clicking the x

  4. Click Add

    Set Name to lab2070-t2

    Add the template profile, template2070, by clicking the + next to Configuration / Profiles

    Set the broker/name to context-broker

    Click Save

    cluster/count is ignored because the override by the template profile.

  5. Close the lab2070-t2 editor by clicking the x

23.1.14.3.1.10. Observer the clusters being built

  1. Navigate to Machines

  2. Observe the named machines being created both clusters

    As the clusters build, two sets of machines will be created with lab2070-t1- and lab2070-t2-.

    The clusters are built in parallel once created.

23.1.14.3.1.11. Clean up the clusters

  1. Navigate to Clusters

  2. Select all three clusters (lab2070, lab2070-t1, lab2070-t2) in the table

  3. Click Actions and then select Work Flow Mode

  4. Click Actions and then select Delete (Cleanup)

  5. Click Cleanup to confirm the action

  6. Wait for the clusters and machines to be removed