Simplify multi-cluster management: Auto-import of hosted clusters with RHACM

Simplify the management of numerous Red Hat OpenShift HyperShift (HCP) clusters by automating their discovery and import using Red Hat Advanced Cluster Management for Kubernetes (RHACM). This automated process, which leverages RHACM's policy framework and multicluster engine for Kubernetes, is designed to replace manual, error-prone tasks with a reliable and scalable workflow for continuous governance.

 Try Red Hat Advanced Cluster Management for Kubernetes

The policy framework of Red Hat Advanced Cluster Management for Kubernetes (RHACM) goes far beyond simple compliance. With object-templates-raw and Go templates, you can:

  • Query resources dynamically using the lookup function.
  • Apply complex conditional logic.
  • Iterate over multiple resources.
  • Access ConfigMaps for external configuration.
  • Execute actions based on a current cluster state.

Let's use all this power to create a robust and scalable auto-import solution.

In this lesson, you will:

  • Enable the addon-discovery.
  • Upload the addon-discovery to the managed cluster.
  • Verify the hypershift-addon deployment.

Enable the hypershift add-on

After all your multicluster engine operator clusters are imported into RHACM, you need to enable the hypershift-addon for those managed multi-cluster engine operator clusters to discover the hosted clusters.

Default add-ons are installed into a different namespace in the previous procedures. Similarly, you install the hypershift-addon into a different namespace in a multi-cluster engine operator, so the add-ons agent for a multi-cluster engine operator local-cluster and the agent for RHACM, can work in a multi-cluster engine operator.

Important

For all the following commands, replace <managed-cluster-names> with comma-separated managed cluster names for multi-cluster engine operator.

For ease of understanding, let's assume:

  • Hosting Cluster Name (your MCE cluster): hc-site1-lab

  • Hosted Cluster Agent Nodes: cluster-workload-linux

Step 1: Enable the addon-discovery

We will enable an add-on and disable metric collection to save resources.

oc patch addondeploymentconfig hypershift-addon-deploy-config -n multicluster-engine --type=merge -p '{"spec":{"agentInstallNamespace":"open-cluster-management-agent-addon-discovery"}}'
oc patch addondeploymentconfig hypershift-addon-deploy-config -n multicluster-engine --type=merge -p '{"spec":{"customizedVariables":[{"name":"disableMetrics","value": "true"},{"name":"disableHOManagement","value": "true"}]}}'

Step 2: Upload the addon-discovery to the managed cluster

Run the following command to enable a hypershift-addon for the multi-cluster engine operator of your managed MCE cluster. Example:

clusteradm addon enable --names hypershift-addon --clusters <managed-cluster-name>
oc get managedclusteraddon hypershift-addon -n <managed-cluster-name>
NAME               AVAILABLE   DEGRADED   PROGRESSING
hypershift-addon   True        False      False

Step 3: Verify hypershift-addon deployment

Now, go back to your MCE cluster (not the RHACM cluster) and verify that the hypershift-addon is installed in the namespace that you specified.

oc get deployment -n open-cluster-management-agent-addon-discovery

NAME                                 READY   UP-TO-DATE   AVAILABLE   AGE
cluster-proxy-proxy-agent            1/1     1            1           64m
hypershift-addon-agent               1/1     1            1           3m8s  <--- THIS ONE
klusterlet-addon-workmgr             1/1     1            1           64m
managed-serviceaccount-addon-agent   1/1     1            1           64m
Previous resource
Import the MCE Cluster
Next resource
Automate the import for discovered hosted clusters