cm attach cluster --cluster <cluster-name> --cluster-kubeconfig <path-to-KUBECONFIG>
Many validated patterns require importing a cluster into a managed group. These groups have specific application sets that will be deployed and managed. Some examples are factory clusters in the Industrial Edge pattern, or development clusters in Multi-cluster DevSecOps pattern.
Red Hat Advanced Cluster Management (RHACM) can be used to create a cluster of a specific cluster group type. You can deploy a specific cluster that way if you have RHACM set up with credentials for deploying clusters. However in many cases an OpenShift cluster has already been created and will be imported into the set of clusters that RHACM is managing.
While you can create and deploy in this manner this section concentrates on importing an existing cluster and designating a specific managed cluster group type.
To deploy a cluster that can be imported into RHACM, use the
openshift-install program provided at console.redhat.com. You will need login credentials.
After ACM is installed a message regarding a "Web console update is available" will be displayed. Click on the "Refresh web console" link.
On the upper-left side you’ll see a pull down labeled "local-cluster". Select "All Clusters" from this pull down. This will navigate to the RHACM console and to its "Clusters" section
Select the "Import cluster" option.
On the "Import an existing cluster" page, enter the cluster name (arbitrary) and choose Kubeconfig as the "import mode". Add the tag
clusterGroup= using the appropriate cluster group specified in the pattern. Press
Using this method, you are done. Skip to the section in your pattern documentation that describes how you can confirm the pattern deployed correctly on the managed cluster.
Install the cm-cli (
cm) (cluster management) command-line tool. See installation instructions here: cm-cli installation
Obtain the KUBECONFIG file from the managed cluster.
On the command-line login into the hub/datacenter cluster (use
oc loginor export the KUBECONFIG).
Run the following command:
You can also use
clusteradm to join a cluster. The following instructions explain what needs to be done.
clusteradm is still in testing.
To deploy a edge cluster you will need to get the hub/datacenter cluster’s token. You will need to install
clusteradm. When it is installed run the following on existing hub/datacenter cluster:
clusteradm get token
When you run the
clusteradmcommand above it replies with the token and also shows you the command to use on the managed. Login to the managed cluster with either of the following methods:
Then request to that the managed join the datacenter hub.
clusteradm join --hub-token <token from clusteradm get token command > <managed-cluster-name>
Back on the hub cluster accept the join request.
clusteradm accept --clusters <managed-cluster-name>
If you use the command line tools above you need to explicitly indicate that the imported cluster is part of a specific clusterGroup. If you haven’t tagged the cluster as
clusterGroup=<managed-cluster-group> then do that now. Some examples of
We do this by adding the label referenced in the managedSite’s
Find the new cluster.
oc get managedclusters.cluster.open-cluster-management.io
Apply the label.
oc label managedclusters.cluster.open-cluster-management.io/<your-cluster> clusterGroup=<managed-cluster-group>