cm attach cluster --cluster <cluster-name> --cluster-kubeconfig <path-to-KUBECONFIG>
Importing a managed cluster
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.
Importing a cluster using the RHACM User Interface
Getting to the RHACM user interface
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.
Importing the cluster
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.
Other potential import tools
There are a two other known ways to join a cluster to the RHACM hub. These methods are not supported but have been tested once. The patterns team no longer tests these methods. If these methods become supported we will maintain the documentation here.
Using the cm-cli tool
Using the clusteradm tool
Importing a cluster using the cm-cli tool
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:
Importing a cluster using
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>
Designate the new cluster as a devel site
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>