::: {.index} pair: Create a Cluster with Named Machines; Labs :::
2070 Create a Cluster with Named Machines¶
Overview¶
- Id: 2070
- Time: 15 Minutes
- Enabled: Yes
- Difficulty: intermediate
- Tags: clusters, profiles, resource_brokers
- Concepts: params, clusters
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.
Prerequisites¶
Required Labs:
- 2060
Summary¶
Create an empty cluster¶
- Navigate to Clusters
Click
AddSet
Nametolab2070Set the
broker/nametocontext-brokerSet the
cluster/countto 0With 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
Saveand wait for it to enter Work Order Mode
Create a named set of machines for the cluster¶
- Navigate to the lab2070 cluster's Params tab
- Click
Add Paramsand selectcluster/machines- Click
Add Paramsand selectcluster/machine-typesSet the
cluster/machines-typesparamter valueThe default value is acceptable.
Set the
cluster/machinesparamter valueSet the value to:
Click the little
saveiconHover over the
cluster/machinestext to review the inline help for formattingNavigate to the Activity tab
Click
Applyto run theuniversal-application-base-clusterWork OrderThis Work Order reevaluates the parameters of the cluster to grow or shrink the cluster.
Observe the cluster being built¶
- Navigate to Machines
Observe the named machines being created
As the cluster builds, machines named
lab2070-red,lab2070-green, andlab2070-bluewill appear.
Create a named set of machines for the cluster¶
- Navigate to the lab2070 cluster's Params tab
Edit the
cluster/machinesparamter valueSet the value to:
Click the little
saveiconNavigate to the Activity tab
Click
Applyto run theuniversal-application-base-clusterWork OrderThis Work Order reevaluates the parameters of the cluster to grow or shrink the cluster.
Observer the cluster being updated¶
- Navigate to Machines
Observe the named machines being created and removed
As the cluster updates, the machine
lab2070-greenwill be removed and thelab2070-yellowmachine will be added.
Create a new class of named set of machines for the cluster¶
- Navigate to the lab2070 cluster's Params tab
Edit the
cluster/machine-typesparamter valueMake the value look like this:
Edit the
cluster/machinesparamter valueSet the value to:
{ "machine": { "names": [ "lab2070-red", "lab2070-yellow", "lab2070-blue" ] }, "leader": { "names": [ "lab2070-leader" ] } }Click the little
saveiconNavigate to the Activity tab
Click
Applyto run theuniversal-application-base-clusterWork OrderThis Work Order reevaluates the parameters of the cluster to grow or shrink the cluster.
Observer the cluster being updated to have a leader¶
- Navigate to Machines
Observe the new leader named machine being created
As the cluster updates, the machine
lab2070-leaderwill be added.
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.
- Navigate to Profiles
Click
CreateSet 'Name' to
template2070Click 'Save'
Click
Add Paramsand addcluster/machine-typesandcluster-machinesEdit
cluster/machine-typesSet the value to:
Click the little
saveiconEdit
cluster/machinesSet the value to:
{ "leader": { "names": [ "{{.Machine.Name}}-leader" ] }, "machine": { "names": [ "{{.Machine.Name}}-red", "{{.Machine.Name}}-green", "{{.Machine.Name}}-yellow" ] } }Click the little
saveiconThe
{{.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}}.
Create a couple of clusters using the template¶
- Navigate to Clusters
Click
AddSet
Nametolab2070-t1Add the template profile,
template2070, by clicking the+next to Configuration / ProfilesSet the
broker/nametocontext-brokerClick
Save
cluster/countis ignored because the override by the template profile.Close the
lab2070-t1editor by clicking thexClick
AddSet
Nametolab2070-t2Add the template profile,
template2070, by clicking the+next to Configuration / ProfilesSet the
broker/nametocontext-brokerClick
Save
cluster/countis ignored because the override by the template profile.Close the
lab2070-t2editor by clicking thex
Observer the clusters being built¶
- Navigate to Machines
Observe the named machines being created both clusters
As the clusters build, two sets of machines will be created with
lab2070-t1-andlab2070-t2-.The clusters are built in parallel once created.
Clean up the clusters¶
- Navigate to Clusters
- Select all three clusters (
lab2070,lab2070-t1,lab2070-t2) in the table- Click
Actionsand then selectWork Flow Mode- Click
Actionsand then selectDelete (Cleanup)- Click
Cleanupto confirm the action- Wait for the clusters and machines to be removed