Chapter 7. Enabling ManagedServiceAccount add-ons (Technology Preview)
When you install the multicluster engine for Kubernetes operator, the ManagedServiceAccount add-on is disabled by default. This component when enabled allows you to create or delete a service account on a managed cluster.
Required access: Editor
When a ManagedServiceAccount custom resource is created in the <managed_cluster> namespace on the hub cluster, a ServiceAccount is created on the managed cluster.
A TokenRequest is made with the ServiceAccount on the managed cluster to the Kubernetes API server on the managed cluster. The token is then stored in a Secret in the <target_managed_cluster> namespace on the hub cluster.
Note: The token can expire and be rotated. See TokenRequest for more information about token requests.
7.1. Prerequisites Copy linkLink copied to clipboard!
- Red Hat OpenShift Container Platform version 4.9 or later must be deployed in your environment, and you must be logged in with the command line interface (CLI).
- You need the multicluster engine for Kubernetes operator installed.
7.2. Enabling ManagedServiceAccount Copy linkLink copied to clipboard!
To enable a Managed-ServiceAccount add-on for a hub cluster and a managed cluster, complete the following steps:
-
Enable the
ManagedServiceAccountadd-on on hub cluster. See Advanced configuration to learn more. Deploy the
ManagedServiceAccountadd-on and apply it to your target managed cluster. Create the following YAML file and replacetarget_managed_clusterwith the name of the managed cluster where you are applying theManaged-ServiceAccountadd-on:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the following command to apply the file:
oc apply -f -
oc apply -f -Copy to Clipboard Copied! Toggle word wrap Toggle overflow You have now enabled the
Managed-ServiceAccountplugin for your managed cluster. See the following steps to configure aManagedServiceAccount.Create a
ManagedServiceAccountcustom resource with the following YAML source:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
managed_serviceaccount_namewith the name of yourManagedServiceAccount. -
Replace
target_managed_clusterwith the name of the managed cluster to which you are applying theManagedServiceAccount.
-
Replace
To verify, view the
tokenSecretRefattribute in theManagedServiceAccountobject status to find the secret name and namespace. Run the following command with your account and cluster name:oc get managedserviceaccount <managed_serviceaccount_name> -n <target_managed_cluster> -o yaml
oc get managedserviceaccount <managed_serviceaccount_name> -n <target_managed_cluster> -o yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow View the
Secretcontaining the retrieved token that is connected to the createdServiceAccounton the managed cluster. Run the following command:oc get secret <managed_serviceaccount_name> -n <target_managed_cluster> -o yaml
oc get secret <managed_serviceaccount_name> -n <target_managed_cluster> -o yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow