Questo contenuto non è disponibile nella lingua selezionata.
Secure clusters
Secure your clusters with role-based access and certificates.
Abstract
Chapter 1. Securing clusters Copia collegamentoCollegamento copiato negli appunti!
You might need to manually create and manage the access control on your cluster. To do this, you must configure authentication service requirements for Red Hat Advanced Cluster Management for Kubernetes to onboard workloads to Identity and Access Management (IAM).
Use the role-based access control and authentication to identify the user associated roles and cluster credentials. To create and manage your cluster credentials, access the credentials by going to the Kubernetes secrets where they are stored. See the following documentation for information about access and credentials:
Required access: Cluster administrator
1.1. Role-based access control Copia collegamentoCollegamento copiato negli appunti!
Red Hat Advanced Cluster Management for Kubernetes supports role-based access control (RBAC). Your role determines the actions that you can perform. RBAC is based on the authorization mechanisms in Kubernetes, similar to Red Hat OpenShift Container Platform. For more information about RBAC, see the OpenShift RBAC overview in the OpenShift Container Platform documentation.
Note: Action buttons are disabled from the console if the user-role access is impermissible.
1.1.1. Overview of roles Copia collegamentoCollegamento copiato negli appunti!
Some product resources are cluster-wide and some are namespace-scoped. You must apply cluster role bindings and namespace role bindings to your users for consistent access controls. View the table list of the following role definitions that are supported in Red Hat Advanced Cluster Management for Kubernetes:
| Role | Definition |
|
|
This is an OpenShift Container Platform default role. A user with cluster binding to the |
|
|
A user with cluster binding to the |
|
|
A user with cluster binding to the |
|
|
A user with cluster binding to the |
|
|
A user with cluster binding to the |
|
|
A user with cluster binding to the |
|
|
A user with the |
| admin, edit, view |
Admin, edit, and view are OpenShift Container Platform default roles. A user with a namespace-scoped binding to these roles has access to |
|
|
A user with the |
Important:
- Any user can create projects from OpenShift Container Platform, which gives administrator role permissions for the namespace.
-
If a user does not have role access to a cluster, the cluster name is not displayed. The cluster name might be displayed with the following symbol:
-.
1.1.2. Console and API RBAC tables Copia collegamentoCollegamento copiato negli appunti!
To understand the role-based access control of the components, view the following console and API RBAC tables:
| Resource | Admin | Edit | View |
|---|---|---|---|
| Application | create, read, update, delete | create, read, update, delete | read |
| Channel | create, read, update, delete | create, read, update, delete | read |
| Subscription | create, read, update, delete | create, read, update, delete | read |
| API | Admin | Edit | View |
|---|---|---|---|
|
| create, read, update, delete | create, read, update, delete | read |
|
| create, read, update, delete | create, read, update, delete | read |
|
| create, read, update, delete | create, read, update, delete | read |
|
| create, read, update, delete | create, read, update, delete | read |
|
| create, read, update, delete | create, read, update, delete | read |
|
| create, read, update, delete | create, read, update, delete | read |
|
| create, read, update, delete | create, read, update, delete | read |
|
| create, read, update, delete | create, read, update, delete | read |
|
| create, read, update, delete | create, read, update, delete | read |
|
| create, read, update, delete | create, read, update, delete | read |
| Resource | Admin | Edit | View |
|---|---|---|---|
| Policies | create, read, update, delete | read, update | read |
| PlacementBindings | create, read, update, delete | read, update | read |
| Placements | create, read, update, delete | read, update | read |
| PlacementRules (deprecated) | create, read, update, delete | read, update | read |
| PolicyAutomations | create, read, update, delete | read, update | read |
| API | Admin | Edit | View |
|---|---|---|---|
|
| create, read, update, delete | read, update | read |
|
| create, read, update, delete | read, update | read |
|
| create, read, update, delete | read, update | read |
| API | Admin | Edit | View |
|
| create, read, update, and delete | read, update | read |
|
| create, get, list, watch, update, delete, patch | - | - |
|
| get, list, watch | get, list, watch | get, list, watch |
| Role | Role description |
|
| Only view all Red Hat OpenShift Virtualization resources in your cluster. |
|
| Create, view, edit, and delete Red Hat OpenShift Virtualization resources in your cluster. |
|
|
Create, view, edit, and delete resources for Red Hat OpenShift Virtualization. You can also access the |
|
|
An extension of the default |
|
|
An extension of the default |
|
| Grants administrator privileges for virtual machine migrations across clusters. Grants prerequisite permissions to view virtual machines in the multicluster Red Hat OpenShift Virtualization console from your hub cluster. |
|
| Grants view only privileges for virtual machine migrations across clusters. Grants prerequisite permissions to view virtual machines in the multicluster Red Hat OpenShift Virtualization console from your hub cluster. |
1.1.3. Additional resources Copia collegamentoCollegamento copiato negli appunti!
- To understand the actions you can complete for each component, see Implementing role-based access control for more details.
1.2. Implementing role-based access control Copia collegamentoCollegamento copiato negli appunti!
Red Hat Advanced Cluster Management for Kubernetes role-based access control (RBAC) helps you to validate roles at the console level and at the API level. You can enable or disable actions in the console based on user access role permissions.
The multicluster engine operator is a prerequisite and the cluster lifecycle function of Red Hat Advanced Cluster Management. To manage RBAC for clusters with the multicluster engine operator, use the RBAC guidance from the cluster lifecycle multicluster engine for Kubernetes operator Role-based access control documentation.
View the following sections for more information about RBAC for specific lifecycles for Red Hat Advanced Cluster Management:
1.2.1. Enabling RBAC for cluster management Copia collegamentoCollegamento copiato negli appunti!
For cluster management actions, you need access to your managed cluster and your hub cluster. If you want to create multiple cluster role bindings, you can use the clusterRoleBindings field to create multiple cluster role bindings in a single ClusterPermission resource.
Complete the following step to create a ClusterPermission resource for creating multiple cluster role bindings:
To create a
ClusterPermissionresource to have many cluster role bindings, run the following command:oc create clusterpermission clusterpermission-multiple-clusterrolebindings -n <cluster-name>
oc create clusterpermission clusterpermission-multiple-clusterrolebindings -n <cluster-name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Your resource might resemble the following YAML with the specified
clusterRoleBindingsfield:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.2.2. Enabling RBAC for Application lifecycle Copia collegamentoCollegamento copiato negli appunti!
When you create an application, the subscription namespace is created, then the configuration map is created within the subscription namespace. You must also have access to the channel namespace. When you want to apply a subscription, you must be a subscription administrator. For more information about managing applications, see Creating an allow and deny list as subscription administrator.
View the following application lifecycle RBAC operations:
Create and administer applications on all managed clusters with a user named
username. You must create a cluster role binding and bind it tousername. Run the following command:oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:cluster-manager-admin --user=<username>
oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:cluster-manager-admin --user=<username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow This role assigns superuser access to all resources and actions. As a superuser, you can create the namespace for the application and all application resources in the namespace with this role.
Create applications that deploy resources to multiple namespaces. You must create a cluster role binding to the
open-cluster-management:subscription-admincluster role, and bind it to a user namedusername. Run the following command:oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:subscription-admin --user=<username>
oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:subscription-admin --user=<username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create and administer applications in the
cluster-namemanaged cluster, with theusernameuser. You must create a cluster role binding to theopen-cluster-management:admin:<cluster-name>cluster role and bind it tousernameby entering the following command:oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:admin:<cluster-name> --user=<username>
oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:admin:<cluster-name> --user=<username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow This role has read and write access to all
applicationresources on the managed cluster,cluster-name. Repeat this if access for other managed clusters is required.Create a namespace role binding to the
applicationnamespace using theadminrole and bind it tousernameby entering the following command:oc create rolebinding <role-binding-name> -n <application-namespace> --clusterrole=admin --user=<username>
oc create rolebinding <role-binding-name> -n <application-namespace> --clusterrole=admin --user=<username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow This role has read and write access to all
applicationresources in theapplicationnamspace. Repeat this if access for other applications is required or if the application deploys to multiple namespaces.You can create applications that deploy resources to multiple namespaces. Create a cluster role binding to the
open-cluster-management:subscription-admincluster role and bind it tousernameby entering the following command:oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:subscription-admin --user=<username>
oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:subscription-admin --user=<username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To view an application on a managed cluster named
cluster-namewith the user namedusername, create a cluster role binding to theopen-cluster-management:view:cluster role and bind it tousername. Enter the following command:oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:view:<cluster-name> --user=<username>
oc create clusterrolebinding <role-binding-name> --clusterrole=open-cluster-management:view:<cluster-name> --user=<username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow This role has read access to all
applicationresources on the managed cluster,cluster-name. Repeat this if access for other managed clusters is required.Create a namespace role binding to the
applicationnamespace using theviewrole and bind it tousername. Enter the following command:oc create rolebinding <role-binding-name> -n <application-namespace> --clusterrole=view --user=<username>
oc create rolebinding <role-binding-name> -n <application-namespace> --clusterrole=view --user=<username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow This role has read access to all
applicationresources in theapplicationnamspace. Repeat this if access for other applications is required.
1.2.3. Enabling RBAC for Governance Copia collegamentoCollegamento copiato negli appunti!
For Governance actions, you need access to the namespace where the policy is created, along with access to the managed cluster where the policy is applied. The managed cluster must also be part of a ManagedClusterSet that is bound to the namespace. To continue to learn about ManagedClusterSet, see ManagedClusterSets Introduction.
After you select a namespace, such as rhacm-policies, with one or more bound ManagedClusterSets, and after you have access to create Placement objects in the namespace, view the following operations:
To create a
ClusterRolenamedrhacm-edit-policywithPolicy,PlacementBinding, andPolicyAutomationedit access, run the following command:oc create clusterrole rhacm-edit-policy --resource=policies.policy.open-cluster-management.io,placementbindings.policy.open-cluster-management.io,policyautomations.policy.open-cluster-management.io,policysets.policy.open-cluster-management.io --verb=create,delete,get,list,patch,update,watch
oc create clusterrole rhacm-edit-policy --resource=policies.policy.open-cluster-management.io,placementbindings.policy.open-cluster-management.io,policyautomations.policy.open-cluster-management.io,policysets.policy.open-cluster-management.io --verb=create,delete,get,list,patch,update,watchCopy to Clipboard Copied! Toggle word wrap Toggle overflow To create a policy in the
rhacm-policiesnamespace, create a namespaceRoleBinding, such asrhacm-edit-policy, to therhacm-policiesnamespace using theClusterRolecreated previously. Run the following command:oc create rolebinding rhacm-edit-policy -n rhacm-policies --clusterrole=rhacm-edit-policy --user=<username>
oc create rolebinding rhacm-edit-policy -n rhacm-policies --clusterrole=rhacm-edit-policy --user=<username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow To view policy status of a managed cluster, you need permission to view policies in the managed cluster namespace on the hub cluster. If you do not have
viewaccess, such as through the OpenShiftviewClusterRole, create aClusterRole, such asrhacm-view-policy, with view access to policies with the following command:oc create clusterrole rhacm-view-policy --resource=policies.policy.open-cluster-management.io --verb=get,list,watch
oc create clusterrole rhacm-view-policy --resource=policies.policy.open-cluster-management.io --verb=get,list,watchCopy to Clipboard Copied! Toggle word wrap Toggle overflow To bind the new
ClusterRoleto the managed cluster namespace, run the following command to create a namespaceRoleBinding:oc create rolebinding rhacm-view-policy -n <cluster name> --clusterrole=rhacm-view-policy --user=<username>
oc create rolebinding rhacm-view-policy -n <cluster name> --clusterrole=rhacm-view-policy --user=<username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.2.4. Enabling RBAC for Observability Copia collegamentoCollegamento copiato negli appunti!
To view the observability metrics for a managed cluster, you must have view access to that managed cluster on the hub cluster. View the following list of observability features:
Access managed cluster metrics.
Users are denied access to managed cluster metrics, if they are not assigned to the
viewrole for the managed cluster on the hub cluster. Run the following command to verify if a user has the authority to create amanagedClusterViewrole in the managed cluster namespace:oc auth can-i create ManagedClusterView -n <managedClusterName> --as=<user>
oc auth can-i create ManagedClusterView -n <managedClusterName> --as=<user>Copy to Clipboard Copied! Toggle word wrap Toggle overflow As a cluster administrator, create a
managedClusterViewrole in the managed cluster namespace. Run the following command:oc create role create-managedclusterview --verb=create --resource=managedclusterviews -n <managedClusterName>
oc create role create-managedclusterview --verb=create --resource=managedclusterviews -n <managedClusterName>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Then apply and bind the role to a user by creating a role bind. Run the following command:
oc create rolebinding user-create-managedclusterview-binding --role=create-managedclusterview --user=<user> -n <managedClusterName>
oc create rolebinding user-create-managedclusterview-binding --role=create-managedclusterview --user=<user> -n <managedClusterName>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Search for resources.
To verify if a user has access to resource types, use the following command:
oc auth can-i list <resource-type> -n <namespace> --as=<rbac-user>
oc auth can-i list <resource-type> -n <namespace> --as=<rbac-user>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note:
<resource-type>must be plural.To view observability data in Grafana, you must have a
RoleBindingresource in the same namespace of the managed cluster.View the following
RoleBindingexample:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
See Role binding policy for more information. See Observability advanced configuration to configure observability.
1.3. Fine-grained role-based access control for virtual machines Copia collegamentoCollegamento copiato negli appunti!
Red Hat Advanced Cluster Management for Kubernetes supports fine-grained role-based access control (RBAC) for virtual machine scenarios. See the following topics for more information about fine-grained RBAC for virtual machines:
- Fine-grained RBAC roles and descriptions
- Enabling fine-grained RBAC for virtual machines
- Fleet Management console role assignment
- Creating role assignments by using identities in the console
- Creating role assignments by using roles in the console
- Creating role assignments by using clusters in the console
- Creating role assignments by using cluster sets in
- Fine-grained role-based access control MulticlusterRoleAssignment
- MulticlusterRoleAssignment examples for fine-grained role-based access control
1.4. Fine-grained RBAC roles and descriptions Copia collegamentoCollegamento copiato negli appunti!
Red Hat Advanced Cluster Management provides specialized roles for managing virtual machines across clusters, which extend the standard virtualization capabilities to provide specific access levels within the fleet virtualization interface.
The following table describes the fine-grained roles that are available for virtualization management:
| Role name | Description |
|---|---|
|
|
Extends the default |
|
|
Extends the default |
|
| A prerequisite role that provides the permissions required to view the fleet virtualization console. |
|
| A prerequisite role that provides the permissions required to view the fleet virtualization console and perform cross-cluster live migrations and related administrative tasks. |
|
| Grants the permissions required for cross-cluster live migration readiness checks between source and destination clusters. |
In addition to Red Hat Advanced Cluster Management roles, use the following standard Red Hat OpenShift Virtualization roles to grant core virtual machine permissions. These roles are installed automatically with the virtualization operator:
-
kubevirt.io:view -
kubevirt.io:edit -
kubevirt.io:admin
For a complete definition of the permissions granted by each role, see Default cluster roles for OpenShift Virtualization in the OpenShift Container Platform documentation.
Use the following scenarios to determine which roles to assign based on your management requirements:
- Scenario one
Least privilege console visibility
Grant a user or group the minimum permissions required to view virtual machines in the fleet virtualization console.
Expand Table 1.9. Roles for scenario one console visibility Role Location Binding type Purpose acm-vm-fleet:viewHub cluster
ClusterRoleBindingGrants access to view the fleet virtualization console.
kubevirt.io:viewManaged cluster
RoleBindingGrants read-only access to
kubevirtresources.- Scenario two
Administrative privilege in the fleet virtualization console
Grant a user or group the permissions required to view, troubleshoot, and manage virtual machine resources in the fleet virtualization console. See the following table for the roles that are required to provide administrative privileges in the fleet virtualization console and the associated permissions for each role:
Expand Table 1.10. Roles for scenario two administrative privilege fleet virtualization console Role Location Binding type Purpose acm-vm-fleet:viewHub cluster
ClusterRoleBindingGrants access to view the fleet virtualization console.
kubevirt.io:adminManaged cluster
RoleBindingGrants administrative access to
kubevirtresources.acm-vm-extended:adminManaged cluster
RoleBindingGrants administrative access to extended virtual machine resources.
- Scenario three
Cross-cluster live migration
Grant a user or group the permissions that are required to perform live migrations of virtual machines between clusters. See the following table for the roles that are required to perform cross-cluster live migrations and the associated permissions for each role:
Expand Table 1.11. Roles for cross-cluster live migration Role Location Binding type Purpose acm-vm-fleet:adminHub cluster
ClusterRoleBindingGrants access to the fleet virtualization console and enables live migration tasks.
kubevirt.io:adminSource and destination managed clusters
RoleBindingGrants administrative access to
kubevirtresources.acm-vm-extended:adminSource and destination managed clusters
RoleBindingGrants administrative access to extended virtual machine resources.
acm-vm-cluster-migration:viewSource and destination managed clusters
ClusterRoleBindingGrants access for live migration readiness checks.
1.5. Enabling fine-grained role-based access control for virtualization Copia collegamentoCollegamento copiato negli appunti!
Enable fine-grained role-based access control for virtualization to manage and grant permissions to other users at the namespace level and cluster level on your managed clusters. RBAC for virtualization provides the capability to grant permissions to a virtual machine namespace within a cluster without granting permission to the entire managed cluster.
Required access: Cluster administrator
To learn about OpenShift Container Platform default and virtualization roles and permissions, see Authorization in the OpenShift Container Platform documentation.
Prerequisites
See the following prerequisites that are needed to enable fine-grained role-based access control for virtual machines in your environment:
- Install a supported version of Red Hat OpenShift Virtualization on your hub cluster and all managed clusters where you intend to manage virtual machines. For more information, see Virtualization - Installing.
- Optional: Install the migration toolkit for virtualization if you plan to perform virtual migrations. See Migrating virtual machines between clusters.
-
Note: If you enable the
cnv-mtv-integrationsfeature in Red Hat Advanced Cluster Management, the product automatically installs and configures both the Red Hat OpenShift Virtualization and migration toolkit for virtualization for you. -
Ensure your hub cluster is self-managed as a
local-cluster, which means thedisableHubSelfManagementparameter is set tofalse, the default setting from when you installed Red Hat Advanced Cluster Management. - Configure the Red Hat Advanced Cluster Management hub cluster and all managed clusters with the same identities. Users, groups, and group memberships must be identical across the environment to ensure that an identity authenticated on the hub cluster maps correctly to the same identity on the managed clusters.
Procedure
See the following steps to enable the fine-grained-rbac component in the MultiClusterHub resource:
-
Run the following command to patch the resource. The default name of the custom resource is
multiclusterhub, andopen-cluster-managementis the default namespace. If you have a different name or namespace, update the command:
oc patch mch multiclusterhub -n open-cluster-management --type=json -p='[{"op": "add", "path": "/spec/overrides/components/-", "value": {"name": "fine-grained-rbac", "enabled": true}}]'
oc patch mch multiclusterhub -n open-cluster-management --type=json -p='[{"op": "add", "path": "/spec/overrides/components/-", "value": {"name": "fine-grained-rbac", "enabled": true}}]'
Next, see Enabling fine-grained role-based access control with the console for instructions on how to assign roles to users and groups from the console.
1.6. Fleet Management console role assignment Copia collegamentoCollegamento copiato negli appunti!
In Red Hat Advanced Cluster Management, role assignments define how users interact with your fleet. Understanding the scope of role assignments is essential for maintaining a secure, multi-tenant environment. See the following sections for details on the different role types, granularity scopes, and methods that are available in the Fleet Management console.
- Granularity
Cluster versus project role assignments
Before you create a role assignment, determine the appropriate scope for the identity. The level of granularity ensures that users have the necessary permissions without compromising cluster security.
- Cluster role assignment
- Grants the identity access to all namespaces within the targeted clusters or cluster sets. Use this scope for cluster administrators or infrastructure operators who require global visibility and control.
- Project role assignment
- Enforces a strict security boundary by granting access only to specific projects, which are namespaces within clusters or cluster sets. Use this scope for application development teams or line-of-business users in a multi-tenant environment.
- Method
Paths to accessing role assignments
You can manage role assignments through several paths in the console. The path you choose depends on whether you are managing global infrastructure or specific application resources.
From the console, navigate to Fleet Management in the console to find one of the following methods:
| Method | Use case |
|---|---|
| Identities | Use this path to manage role assignments for a specific user or group. |
| Roles | Use this path to manage role assignments for a specific role. |
| Clusters | Use this path to manage role assignments for a specific managed cluster. |
| Cluster sets | Use this path to manage role assignments for a logical group of clusters. |
Important: Role assignments are additive. For example, if a user is granted a role at the cluster set level and a different role at the project level, the user inherits the permissions of both assignments.
See the following sections for step-by-step instructions on how to create role assignments by using each method in the console:
1.7. Creating role assignments by using identities in the console Copia collegamentoCollegamento copiato negli appunti!
You can manage access permissions for a specific user or group from the Fleet Management console.
Required access: Cluster administrator
Prerequisites
See the following requirements to begin using fine-grained role-based access control:
- Enable the fine-grained role-based access control. See Enabling fine-grained role-based access control for virtualization for the procedure.
- You must be logged in to the OpenShift Container Platform console with cluster administrator or hub cluster administrator permissions.
- The target user or group must already exist in the system. If the identity is not listed, configure your identity provider before you proceed.
Procedure
- From the navigation menu, expand User Management and click Identities.
- Select either the Users tab, or the Groups tab.
- Click the name of the user or group that you want to manage.
- Click the Role Assignments tab.
- Click Create role assignment. The configuration window opens with the identity information already populated.
In the Scope section, define the reach of the permissions by selecting one of the following options:
- Global access
- Applies permissions to all clusters and namespaces in the hub.
- Select cluster set
- Applies permissions to a specific group of clusters.
- Select clusters
- Applies permissions to individual managed clusters.
- Click Next.
- If you did not select Global access, select the specific cluster sets or clusters from the list and click Next.
Select the level of granularity for the assignment. See the following options:
- Cluster role assignment or Cluster set role assignment
- Grants access to all namespaces within the selection.
- Project role assignment
- Limits access to specific common projects, which are namespaces.
- Click Next.
If you selected Project role assignment, select the target projects.
Note: If the required project does not exist, click Create common project to define a new project. New projects are created on each cluster that is selected.
- Click Next.
- Select the specific role to apply to the identity and click Next and review the configuration summary for accuracy.
- Click Create to finalize the role assignment.
The new role assignment appears in the Role Assignments table for the selected identity. The permissions take effect the next time the user logs in or refreshes their session.
1.8. Creating role assignments by using roles in the console Copia collegamentoCollegamento copiato negli appunti!
You can assign access permissions to a specific role from the Fleet Management console.
Required access: Cluster administrator
Prerequisites
See the following requirements to begin using fine-grained role-based access control:
- Enable the fine-grained role-based access control. See Enabling fine-grained role-based access control for virtualization for the procedure.
- You must be logged in to the OpenShift Container Platform console with cluster administrator or hub cluster administrator permissions.
Procedure
- From the navigation menu, expand User Management and click Roles.
- Click the name of the role that you want to assign to identities.
- Click the Role Assignments tab.
- Click Create role assignment. The configuration window opens with the role information already populated.
- Select the Identities > Users or Groups that receive this role and click Next.
In the Scope section, define the reach of the permissions by selecting one of the following options:
- Global access
- Applies permissions to all clusters and namespaces in the hub.
- Select cluster set
- Applies permissions to a specific group of clusters.
- Select clusters
- Applies permissions to individual managed clusters.
- Click Next.
- If you did not select Global access, select the specific cluster sets or clusters from the list and click Next.
Select the level of granularity for the assignment:
- Cluster role assignment or Cluster set role assignment
- Grants access to all namespaces within the selection.
- Project role assignment
- Limits access to specific common projects, which are namespaces.
- Click Next.
- If you selected Project role assignment, select the target projects and click Next and review the configuration summary for accuracy.
- Click Create to finalize the role assignment.
The new role assignment is created. You can verify the assignment by viewing the Role Assignments tab for either the selected role or the individual identities.
1.9. Creating role assignments by using clusters in the console Copia collegamentoCollegamento copiato negli appunti!
You can manage access permissions for a specific managed cluster from the Fleet Management console.
Required access: Cluster administrator
Prerequisites
See the following requirements to begin using fine-grained role-based access control:
- Enable the fine-grained role-based access control. See Enabling fine-grained role-based access control for virtualization for the procedure.
- You must be logged in to the OpenShift Container Platform console with cluster administrator or hub cluster administrator permissions.
Procedure
- From the navigation menu, click Clusters to view your cluster inventory.
- Click the name of the target cluster that you want to manage.
- Click the Role Assignments tab.
- Click Create role assignment. The configuration window opens with the cluster information pre-filled.
- Select the Identities > Users or Groups that receive access to this cluster and click Next.
Select the level of granularity for the assignment:
- Cluster role assignment
- Grants access to all namespaces within this cluster.
- Project role assignment
- Limits access to specific common projects, which are namespaces.
- Click Next.
- If you selected Project role assignment, select the target projects and click Next.
- Select the specific role to grant the identities and click Next and review the configuration summary for accuracy.
- Click Create to finalize the role assignment.
The new role assignment is created. You can verify the assignment by viewing the Role Assignments tab for either the selected role or the individual identities.
1.10. Creating role assignments by using cluster sets in the console Copia collegamentoCollegamento copiato negli appunti!
You can manage access permissions for a specific cluster set from the Fleet Management console.
Required access: Cluster administrator
Prerequisites
See the following requirements to begin using fine-grained role-based access control:
- Enable the fine-grained role-based access control. See Enabling fine-grained role-based access control for virtualization for the procedure.
- You must be logged in to the OpenShift Container Platform console with cluster administrator or hub cluster administrator permissions.
Procedure
- From the navigation menu, click Clusters > Cluster Sets to view your cluster set inventory.
- Click the name of the target cluster set that you want to manage.
- Click the Role Assignments tab.
- Click Create role assignment. The configuration window opens with the cluster set information already populated.
- Select the Identities > Users or Groups that receive access to this cluster set and click Next.
Select the level of granularity for the assignment:
- Cluster set role assignment
- Grants access to all namespaces within every cluster in the set.
- Project role assignment
- Limits access to specific common projects, which are namespaces.
- Click Next.
- If you selected Project role assignment, select the target projects and click Next.
- Select the specific role to grant the identities and click Next.
- Review the configuration summary for accuracy.
- Click Create to finalize the role assignment.
The new role assignment is created. You can verify the assignment by viewing the Role Assignments tab for either the selected role or the individual identities.
1.11. Fine-grained role-based access control MulticlusterRoleAssignment Copia collegamentoCollegamento copiato negli appunti!
The MulticlusterRoleAssignment custom resource provides a declarative method for defining role-based access control (RBAC) across a multicluster environment. You can use this resource to create a centralized definition on the hub cluster that specifies which users or groups receive permissions on targeted managed clusters.
When you apply a MulticlusterRoleAssignment resource, the system creates the corresponding standard Kubernetes RBAC bindings, either a RoleBinding or a ClusterRoleBinding, on the selected managed clusters.
1.11.1. Resource specification Copia collegamentoCollegamento copiato negli appunti!
The resource definition consists of two primary sections: the Subject that receives the permission, and the Role Assignments, which are the permissions that are granted and where they apply.
spec.subjectDefines the identity that is receiving the permissions. See the following table for information about the subject specification:
Expand Table 1.13. Subject specification Field Description kindThe type of identity is specified. Supported values are
UserorGroup.nameThe name of the user or group is specified, for example,
jane.doe@example.comordev-team.spec.roleAssignmentsA list of rules that define the roles to be granted, and the target clusters. See the following table for information about the role assignment specification:
Expand Table 1.14. Role assignment specification Field Description clusterRoleThe name of the
ClusterRoleto assign. Note: This role must exist on the managed cluster before the assignment.clusterSelectionSpecifies the target clusters for this assignment using standard placement references.
targetNamespacesOptional: A list of namespaces on the managed cluster where the role applies. This field determines the scope of the resulting binding.
1.11.2. Binding scope Copia collegamentoCollegamento copiato negli appunti!
The resulting RBAC resource on the managed cluster depends on whether you include the targetNamespaces field or not:
RoleBinding-
A namespace-scoped binding. When you list one or more namespaces in the
targetNamespacesfield, the system generates aRoleBindingwithin each of those specific namespaces. The subject receives permissions only within those namespaces. ClusterRoleBinding-
A cluster-scoped binding: When you do not list a
targetNamespacesvalue or leave it empty, the system generates aClusterRoleBinding. The subject receives permissions across the entire managed cluster. clusterSelection-
References Red Hat Advanced Cluster Management placement resources to determine which managed clusters receive the assignment. Important: You must create the placement resource before you create the
MulticlusterRoleAssignment. The resource references existing placements and does not define the placement logic itself.
1.11.3. Placement examples Copia collegamentoCollegamento copiato negli appunti!
The following examples demonstrate how to create different types of role assignments based on your access control needs, using various placement methods to select the target clusters.
Example:
ClusterSetselectionThe following placement selects all clusters that are members of the
cs01ManagedClusterSetspecification:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Example: Cluster name selection
The following placement selects specific clusters by name using a label selector:
See usage examples in Fine-grained MCA examples.
1.12. MulticlusterRoleAssignment examples for fine-grained role-based access control Copia collegamentoCollegamento copiato negli appunti!
See examples for the custom resource usage across a multicluster environment. You can configure various access levels and scopes by using the MulticlusterRoleAssignment resource, as you can see in three examples: namespace, cluster-wide, and mixed.
1.12.1. Usage examples Copia collegamentoCollegamento copiato negli appunti!
The following examples demonstrate how to create different types of role assignments based on your access control needs:
Example one: Namespace-scoped view access
The following configuration grants the user name,
jane.developer, thekubevirt.io:viewrole. Access is restricted to thedefaultnamespace on clusters that are selected by thedev-clustersplacement:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example two: Cluster-wide administrative access
The following configuration grants the group name,
virt-admins, thekubevirt.io:adminrole. Because thetargetNamespacesvalue is omitted, this example provides administrative access across all namespaces on clusters that are selected by theproduction-clustersplacement:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example three: Mixed-scope assignment
You can define multiple assignments within a single resource to create a complex permission profile. The following example grants
test-usersubject theAdminrole on primary clusters and theEditrole on secondary clusters:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.13. Certificates Copia collegamentoCollegamento copiato negli appunti!
All certificates that are required by services that run on Red Hat Advanced Cluster Management are created when you install Red Hat Advanced Cluster Management. View the following list of certificates, which are created and managed by the following components of Red Hat OpenShift Container Platform:
- OpenShift Service Serving Certificates
- Red Hat Advanced Cluster Management webhook controllers
- Kubernetes Certificates API
- OpenShift default ingress
Required access: Cluster administrator
Continue reading to learn more about certificate management:
Note: Users are responsible for certificate rotations and updates.
1.13.1. Red Hat Advanced Cluster Management hub cluster certificates Copia collegamentoCollegamento copiato negli appunti!
OpenShift Container Platform default ingress certificate is a type of hub cluster certificate. After you install Red Hat Advanced Cluster Management, Observability certificates are created and used by the Observability components to give mutual TLS for traffic between the hub and managed cluster. Access the Observability namespaces to retrieve and implement the different Observability certificates.
The following certificates are a part of the
open-cluster-management-observabilitynamespace:-
observability-server-ca-certs: Has the CA certificate to sign server-side certificates -
observability-client-ca-certs: Has the CA certificate to sign client-side certificates -
observability-server-certs: Has the server certificate used by theobservability-observatorium-apideployment -
observability-grafana-certs: Has the client certificate used by theobservability-rbac-query-proxydeployment
-
The
open-cluster-management-addon-observabilitynamespace includes the following certificates on managed clusters:-
observability-managed-cluster-certs: Has the same server CA certificate asobservability-server-ca-certsin the hub server -
observability-controller-open-cluster-management.io-observability-signer-client-cert: Has the client certificate used by themetrics-collector-deployment
-
The CA certificates are valid for five years and other certificates are valid for one year. All Observability certificates are automatically refreshed upon expiration. View the following list to understand the effects when certificates are automatically renewed:
- Non-CA certificates are renewed automatically when the remaining valid time is no more than 73 days. After the certificate is renewed, the pods in the related deployments restart automatically to use the renewed certificates.
- CA certificates are renewed automatically when the remaining valid time is no more than one year. After the certificate is renewed, the old CA is not deleted but co-exist with the renewed ones. Both old and renewed certificates are used by related deployments, and continue to work. The old CA certificates are deleted when they expire.
- When a certificate is renewed, the traffic between the hub cluster and managed cluster is not interrupted.
View the following Red Hat Advanced Cluster Management hub cluster certificates table:
| Namespace | Secret name | Pod label |
|---|---|---|
| open-cluster-management | channels-apps-open-cluster-management-webhook-svc-ca | app=multicluster-operators-channel |
| open-cluster-management | channels-apps-open-cluster-management-webhook-svc-signed-ca | app=multicluster-operators-channel |
| open-cluster-management | multicluster-operators-application-svc-ca | app=multicluster-operators-application |
| open-cluster-management | multicluster-operators-application-svc-signed-ca | app=multicluster-operators-application |
| open-cluster-management-hub | registration-webhook-serving-cert signer-secret | Not required |
| open-cluster-management-hub | work-webhook-serving-cert | Not required |
1.13.2. Red Hat Advanced Cluster Management managed certificates Copia collegamentoCollegamento copiato negli appunti!
Use Red Hat Advanced Cluster Management managed certificates to authenticate managed clusters within your hub cluster. The following managed cluster certificates get managed and refreshed automatically.
If you customize the hub cluster API server certificate, the managed cluster automatically updates its certificates. View the following table for a summarized list of the component pods that contain Red Hat Advanced Cluster Management managed certificates and the related secrets:
| Namespace | Secret name (if applicable) |
|---|---|
| open-cluster-management-agent-addon | cluster-proxy-open-cluster-management.io-proxy-agent-signer-client-cert |
| open-cluster-management-agent-addon | cluster-proxy-service-proxy-server-certificates |
1.13.3. Additional resources Copia collegamentoCollegamento copiato negli appunti!
- Use the certificate policy controller to create and manage certificate policies on managed clusters. See Certificate policy controller for more details.
- For more details about securely connecting to a privately-hosted Git server with SSL/TLS certificates, see Using custom CA certificates for a secure HTTPS connection.
- See OpenShift Service Serving Certificates for more details.
- The OpenShift Container Platform default ingress is a hub cluster certificate. See Replacing the default ingress certificate for more details.
1.14. Managing certificates Copia collegamentoCollegamento copiato negli appunti!
Maintain the security and reliability of your cluster management environment by managing your certificates. Continue reading to learn how to refresh, replace, rotate, and list certificates.
1.14.1. Refreshing a Red Hat Advanced Cluster Management webhook certificate Copia collegamentoCollegamento copiato negli appunti!
You can refresh Red Hat Advanced Cluster Management managed certificates, which are certificates that are created and managed by Red Hat Advanced Cluster Management services.
Complete the following steps to refresh certificates managed by Red Hat Advanced Cluster Management:
Delete the secret that is associated with the Red Hat Advanced Cluster Management managed certificate, and replace
<namespace>and<secret>with the values that you want to use. Run the following command:oc delete secret -n <namespace> <secret>
oc delete secret -n <namespace> <secret>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the services that are associated with the Red Hat Advanced Cluster Management managed certificates, and replace
<namespace>and<pod-label>with the values for the Red Hat Advanced Cluster Management managed cluster certificates. Run the following command:oc delete pod -n <namespace> -l <pod-label>
oc delete pod -n <namespace> -l <pod-label>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note: If a
pod-labelis not specified, there is no service that must be restarted. The secret is recreated and used automatically.
1.14.2. Replacing certificates for alertmanager route Copia collegamentoCollegamento copiato negli appunti!
If you do not want to use the OpenShift Container Platform default ingress certificate, replace observability alertmanager certificates by updating the Alertmanager route. Complete the following steps:
Examine the observability certificate with the following command:
openssl x509 -noout -text -in ./observability.crt
openssl x509 -noout -text -in ./observability.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Change the common name (
CN) on the certificate toalertmanager. -
Change the SAN in the
csr.cnfconfiguration file with the hostname for youralertmanagerroute. Create the
alertmanager-byo-caSecret resource in theopen-cluster-management-observabilitynamespace by running the following command:oc -n open-cluster-management-observability create secret tls alertmanager-byo-ca --cert ./ca.crt --key ./ca.key
oc -n open-cluster-management-observability create secret tls alertmanager-byo-ca --cert ./ca.crt --key ./ca.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
alertmanager-byo-certSecretresource in theopen-cluster-management-observabilitynamespace by running the following command:oc -n open-cluster-management-observability create secret tls alertmanager-byo-cert --cert ./ingress.crt --key ./ingress.key
oc -n open-cluster-management-observability create secret tls alertmanager-byo-cert --cert ./ingress.crt --key ./ingress.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.14.3. Rotating the Gatekeeper webhook certificate Copia collegamentoCollegamento copiato negli appunti!
Complete the following steps to rotate the Gatekeeper webhook certificate:
Edit the
Secretresource that contains the Gatekeeper webhook certificate with the following command:oc edit secret -n openshift-gatekeeper-system gatekeeper-webhook-server-cert
oc edit secret -n openshift-gatekeeper-system gatekeeper-webhook-server-certCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Delete the following content in the
datasection:ca.crt,ca.key,tls.crt, andtls.key. Restart the Gatekeeper webhook service by deleting the
gatekeeper-controller-managerpods with the following command:oc delete pod -n openshift-gatekeeper-system -l control-plane=controller-manager
oc delete pod -n openshift-gatekeeper-system -l control-plane=controller-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow
The Gatekeeper webhook certificate is rotated.
1.14.4. Verifying certificate rotation Copia collegamentoCollegamento copiato negli appunti!
Verify that your certificates are rotated to prevent system outages that can effect service communication. Complete the following steps:
-
Identify the
Secretresource that you want to check. -
Check the
tls.crtkey to verify that a certificate is available. Display the certificate information. Replace
<your-secret-name>with the name of secret that you are verifying. If it is necessary, also update the namespace and JSON path. Run the following command:oc get secret <your-secret-name> -n open-cluster-management -o jsonpath='{.data.tls\.crt}' | base64 -d | openssl x509 -text -nooutoc get secret <your-secret-name> -n open-cluster-management -o jsonpath='{.data.tls\.crt}' | base64 -d | openssl x509 -text -nooutCopy to Clipboard Copied! Toggle word wrap Toggle overflow Check the
Validitydetails in the output. View the followingValidityexample:Validity Not Before: Jul 13 15:17:50 2023 GMT Not After : Jul 12 15:17:50 2024 GMTValidity Not Before: Jul 13 15:17:50 2023 GMT1 Not After : Jul 12 15:17:50 2024 GMT2 Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.14.5. Listing hub cluster managed certificates Copia collegamentoCollegamento copiato negli appunti!
You can view a list of hub cluster managed certificates that use OpenShift Service Serving Certificates service internally. Run the following command to list the certificates:
for ns in multicluster-engine open-cluster-management ; do echo "$ns:" ; oc get secret -n $ns -o custom-columns=Name:.metadata.name,Expiration:.metadata.annotations.service\\.beta\\.openshift\\.io/expiry | grep -v '<none>' ; echo ""; done
for ns in multicluster-engine open-cluster-management ; do echo "$ns:" ; oc get secret -n $ns -o custom-columns=Name:.metadata.name,Expiration:.metadata.annotations.service\\.beta\\.openshift\\.io/expiry | grep -v '<none>' ; echo ""; done
For more information, see OpenShift Service Serving Certificates in the Additional resources section.
Note: If observability is enabled, there are additional namespaces where certificates are created.
1.14.6. Additional resources Copia collegamentoCollegamento copiato negli appunti!
- To understand service serving certificates, see Securing service traffic using service serving certificate secrets.
1.15. Bringing your own Certificate Authority (CA) certificates for observability Copia collegamentoCollegamento copiato negli appunti!
When you install Red Hat Advanced Cluster Management for Kubernetes, only Certificate Authority (CA) certificates for observability are provided by default. If you do not want to use the default observability CA certificates, you can choose to bring your own observability CA certificates before you enable observability.
Prerequisites
Required access: Administrator
1.15.1. Customizing your CA certificates for observability Copia collegamentoCollegamento copiato negli appunti!
When you choose to bring your own observability CA certificate, customize it to make it help you with your specific development needs. Customize your CA certificates for observability with the following steps:
Generate CA certificates for the server-side and the client-side by using OpenSSL commands.
To generate your CA RSA private keys for the server-side, run the following command:
openssl genrsa -out serverCAKey.pem 2048
openssl genrsa -out serverCAKey.pem 2048Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To generate your CA RSA private keys for the client-side, run the following command:
openssl genrsa -out clientCAKey.pem 2048
openssl genrsa -out clientCAKey.pem 2048Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate the self-signed CA certificates using the private keys.
To generate the self-signed CA certificates for the server-side, run the following command:
openssl req -x509 -sha256 -new -nodes -key serverCAKey.pem -days 1825 -out serverCACert.pem
openssl req -x509 -sha256 -new -nodes -key serverCAKey.pem -days 1825 -out serverCACert.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow - To generate the self-signed CA certificates for the client-side, run the following command:
openssl req -x509 -sha256 -new -nodes -key clientCAKey.pem -days 1825 -out clientCACert.pem
openssl req -x509 -sha256 -new -nodes -key clientCAKey.pem -days 1825 -out clientCACert.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow To store and manage your CA certificates for observability, create
Secretresources for each CA certificate.Create the
observability-server-ca-certssecret by using your certificate and private key. Run the following command:oc -n open-cluster-management-observability create secret tls observability-server-ca-certs --cert ./serverCACert.pem --key ./serverCAKey.pem
oc -n open-cluster-management-observability create secret tls observability-server-ca-certs --cert ./serverCACert.pem --key ./serverCAKey.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Create the
observability-client-ca-certssecret by using your certificate and private key. Run the following command:
oc -n open-cluster-management-observability create secret tls observability-client-ca-certs --cert ./clientCACert.pem --key ./clientCAKey.pem
oc -n open-cluster-management-observability create secret tls observability-client-ca-certs --cert ./clientCACert.pem --key ./clientCAKey.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.15.2. Replacing certificates for rbac-query-proxy route Copia collegamentoCollegamento copiato negli appunti!
You can replace certificates for the rbac-query-proxy route by creating a Certificate Signing Request (CSR) by using the csr.cnf file.
Prerequisites
Generate CA certifates by using OpenSSL commands. See, Customizing your CA certificates for observability to create certificates.
Update the DNS.1 field in the subjectAltName section to match the host name of the rbac-query-proxy route. Complete the following steps:
Retrieve the host name by running the following command:
oc get route rbac-query-proxy -n open-cluster-management-observability -o jsonpath=" {.spec.host}"oc get route rbac-query-proxy -n open-cluster-management-observability -o jsonpath=" {.spec.host}"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
proxy-byo-casecret by using the generated certificates. Run the following command:oc -n open-cluster-management-observability create secret tls proxy-byo-ca --cert ./ca.crt --key ./ca.key
oc -n open-cluster-management-observability create secret tls proxy-byo-ca --cert ./ca.crt --key ./ca.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the following command to create a
proxy-byo-certsecret by using the generated certificates:oc -n open-cluster-management-observability create secret tls proxy-byo-cert --cert ./ingress.crt --key ./ingress.key
oc -n open-cluster-management-observability create secret tls proxy-byo-cert --cert ./ingress.crt --key ./ingress.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.15.3. Additional resources Copia collegamentoCollegamento copiato negli appunti!
- For information about updating route certificates to access object stores, see Customizing route certification.
1.16. Role-based access control for managed clusters with cluster permissions Copia collegamentoCollegamento copiato negli appunti!
Manage Kubernetes native resources such as Roles, ClusterRoles, RoleBindings, and ClusterRoleBindings resources across multiple managed clusters from a by using the cluster permission feature. The ClusterPermssion resource automatically distributes role-based access control (RBAC) resources to managed clusters and manage the resource lifecycles.
With the cluster permssions API, clusterpermissions.rbac.open-cluster-management.io, you can specify the RBAC policies you want to apply to your managed clusters.
Learn about how to create and manage cluster permissions in the following topics:
1.16.1. Enabling validation for cluster permissions Copia collegamentoCollegamento copiato negli appunti!
Enable the validate specification within your ClusterPermission resources to check the existence of your Role and ClusterRole resources.
Required access: Cluster administrator
Complete the following steps:
Create a
ClusterPermissionresource where you set thevalidatespecification totrue.Define theroleBindingsandclusterRoleBindingthat you want to validate.Your YAML file might resemble the following example where you configure the
ClusteerRoleto validate theeditClusterRolefor thesa-sample-existingServiceAccount, and theviewClusterRoleforGroup1:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply your
clusterpermission-validate-sampleClusterPermissionby running the following command:oc apply clusterpermission-validate-sample.yaml
oc apply clusterpermission-validate-sample.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow