How to get the resource ID of an ARO cluster?

Solution Verified - Updated -

Environment

  • Azure Red Hat OpenShift 4 (ARO)

Issue

  • How to check if an OpenShift cluster is ARO?
  • How to differentiate if a cluster is a Red Hat managed ARO cluster or a self-managed OCP cluster on Azure platform.

Resolution

An ARO cluster will have an Azure Resource ID that contains Microsoft.RedHatOpenShift on it , which looks like:

/subscriptions/$sub_id/resourceGroups/$rg/providers/Microsoft.RedHatOpenShift/openShiftClusters/$cluster_name

It is possible to get the Resource ID with the az CLI command:

$ az aro show -n [cluster_name] -g [rg_name] --query 'id'

Additional Information in the cluster for ARO clusters only

There is also some information in the cluster to check if it's an ARO cluster or not:

  • Existence of the ARO Custom Resource Definition (CRD) and getting the Resource ID from it (this resource is not collected by must-gather, so it's only available when checking the cluster):

    $ oc get cluster.aro.openshift.io cluster -o custom-columns=NAME:.metadata.name,RESOURCE_ID:.spec.resourceId
    NAME      RESOURCE_ID
    cluster   /subscriptions/$sub_id/resourceGroups/$rg/providers/Microsoft.RedHatOpenShift/openShiftClusters/$cluster_name
    
  • The configmap cluster-config-v1 in namespace kube-system show if the cluster is ARO (it can be shown in a must-gather):

    $ oc get cm cluster-config-v1 -n kube-system -o yaml
    [...]
        platform:
          azure:
            aro: true
    [...]
            image:
              offer: aro4
              publisher: azureopenshift
              sku: aro_48
    [...]
    

Note: The steps below are valid for clusters that were initially installed at version 4.7 or later:

  • The configmap: openshift-install-manifests in namespace openshift-config has ARO in the invoker field (it can be shown in a must-gather):

    $ oc get cm openshift-install-manifests -n openshift-config -o yaml                                                                                                                
    apiVersion: v1
    data:
      invoker: ARO
    [...]
    

Root Cause

An ARO cluster has an Azure Resource ID and also some resources indicating that the cluster is ARO.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments