Role-based access control (RBAC) regulates access to resources based on the roles of users. You can grant multiple permissions to cluster roles and configure different permission policies for different roles to improve account security. This topic describes how to grant Resource Access Management (RAM) users or RAM roles RBAC permissions on an Alibaba Cloud Container Compute Service (ACS) cluster.
Configurations
Item | Description |
Default permissions |
|
Authorization methods |
Note Before you grant permissions to a RAM user or RAM role, make sure that the RAM user or RAM role is granted read-only permissions on the specified cluster in the RAM console. |
Authorization models | You can grant permissions to one or more RAM users or RAM roles at a time. |
To ensure data security, you cannot modify the RAM policies that are attached to your RAM users or RAM roles in the ACS console. You must read the instructions on the authorization page, log on to the RAM console, and then modify the RAM policies.
Grant RBAC permissions to RAM users or RAM roles
Log on to the ACS console. In the left-side navigation pane, click Permission Management.
In the Select RAM User step of the Permission Management page, grant permissions.
ImportantACS clusters are a type of ACK Serverless cluster. If you grant a RAM user or RAM role the permissions to manage all clusters in the ACK console, the RAM user or RAM role is authorized to manage ACS clusters and you cannot grant permissions on ACS clusters to the RAM user or RAM role in the ACS console.
Grant permissions to a RAM user
Click the RAM Users tab. Find the RAM user that you want to manage and click Modify Permissions to go to the Configure Role-Based Access Control (RBAC) step.
Grant permissions to a RAM role
Click the RAM Roles tab. Enter the name of the RAM role that you want to manage and click the search icon. After the RAM role appears, click Modify Permissions to go to the Configure Role-Based Access Control (RBAC) step.
If you want to use a RAM user or RAM role to grant permissions to other RAM users or RAM roles, make sure that the RAM user or RAM role has the required RAM permissions on the cluster that you want to manage. For more information, see Create a custom RAM policy. In addition, the RAM user or RAM role must be assigned the cluster-admin role or administrator role of the cluster.
Click the Configure Role-Based Access Control (RBAC) step, click Add Permissions to add cluster-scoped or namespace-scoped permissions, select a predefined or custom role in the Permission Management column, and then click Next Step.
NoteACS provides the following predefined roles: Administrator, O&M Engineer, Developer, and Restricted User. You can use these roles to regulate access to resources in the ACS console in most scenarios. You can also use custom roles to define permissions on clusters based on your business requirements.
You can assign one predefined role and multiple custom roles of a cluster or namespace to a RAM user or RAM role.
If you want to authorize a RAM user or RAM role to manage all clusters (including newly created clusters), select All Clusters in the Clusters column when you assign a predefined role to the RAM user or RAM role.
In the Submit Authorization step, follow the instructions on the page.
If The authorization is complete is displayed, the RBAC role is assigned to the RAM user or RAM role.
If error message is returned, the RBAC role is not assigned to the RAM user or RAM role. You must read the instructions on the returned page, log on to the RAM console, and then grant read-only permissions on the cluster to the RAM user or RAM role.
In the Submit Authorization step, click Copy and click policy management to go to the Create Policy page in the RAM console.
On the JSON tab, paste the content copied in the previous step to replace the original policy content, click Next to edit policy information, and then click OK.
In the left-side navigation pane of the RAM console, choose
. Find the RAM user that you want to manage and click Add Permissions in the Actions column.In the Add Permissions panel, set Authorized Scope, select Custom Policy, and then search for the policy that you created. Click the name of the policy to move the policy to the Selected section on the right side of the page. Then, click OK. After the policy is attached, click Complete.
Return to the ACS console. In the Submit Authorization step, click Submit Authorization to assign the RBAC roles to the RAM user or RAM role.
After the authorization is complete, you can log on to the ACK console as the RAM user or RAM role to manage the specified cluster.
Use a RAM user or RAM role to grant RBAC permissions to other RAM users or RAM roles
By default, you cannot use a RAM user or RAM role to grant RBAC permissions to other RAM users or RAM roles. If you want to use a RAM user or RAM role to grant RBAC permissions to other RAM users or RAM roles, you must first use the Alibaba Cloud account or a RAM user that is assigned the Administrator role of all clusters to grant the required permissions to the RAM user or RAM role.
RAM permissions
You must attach a RAM policy to the RAM user or RAM role. The RAM policy must provide the following permissions:
The permissions to view other RAM users that belong to the same Alibaba Cloud account.
The permissions to attach RAM policies to other RAM users or RAM roles.
The permissions to view information about ACK clusters.
The permissions to view permissions of RBAC roles.
The permissions to assign RBAC roles to other RAM users or RAM roles.
Log on to the RAM console, create a RAM policy based on the following content, and then attach the RAM policy to the RAM user or RAM role. For more information, see Create a custom RAM policy.
Replace xxxxxx
with the name of the RAM policy you want to authorize the RAM user or RAM role to attach to other RAM users or RAM roles. If you replace xxxxxx with an asterisk (*), the RAM user or RAM role is authorized to attach all RAM policies to other RAM users or RAM roles. The asterisk (*) in the Resource field grants permissions to perform actions on all resources that belong to the UID. The ACK API (cs:*) includes operation permissions on all ACK clusters except ACS clusters. Exercise caution when you grant permissions.
{
"Statement": [{
"Action": [
"ram:Get*",
"ram:List*",
"cs:DescribeClustersV1",
"cs:GrantPermission"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ram:AttachPolicyToUser",
"ram:AttachPolicy"
],
"Effect": "Allow",
"Resource": [
"acs:ram:*:*:policy/xxxxxx",
"acs:*:*:*:user/*"
]
}
],
"Version": "1"
}
After the RAM policy is attached to the RAM user or RAM role, you can use the RAM user or RAM role to attach the specified RAM policies to other RAM users or RAM roles.
RBAC permissions
After you attach the preceding RAM policy to the RAM user or RAM role, you must assign the Administrator or cluster-admin role to the RAM user or RAM role to allow the RAM user or RAM role to access the specified cluster or namespace. For more information, see Grant RBAC permissions to RAM users or RAM roles.
Set a RAM user or RAM role as a permission administrator
After you set a RAM user or RAM role as a permission administrator, you can use the RAM user or RAM role to grant permissions to other RAM users or RAM roles.
Log on to the RAM console and find the RAM user or RAM role that you want to use.
RAM user
In the left-side navigation pane of the RAM console, choose
. Find the RAM user that you want to use and click Add Permissions in the Actions column.RAM role
In the left-side navigation pane of the RAM console, choose
. Find the RAM role that you want to use and click Add Permissions in the Actions column.
In the Add Permissions panel, set Authorized Scope, select System Policy, and then search for the AliyunRAMFullAccess and AliyunACCFullAccess policies. Click the name of each policy to move the policy to the Selected section on the right side of the page. Then, click OK. After the policies are attached, click Complete.
Log on to the ACS console and assign the Administrator role to the RAM user or RAM role to allow the RAM user or RAM role to access all clusters.
For more information, see the Grant RBAC permissions to RAM users or RAM roles section of this topic.
After the preceding steps are complete, the RAM user or RAM role is set as a permission administrator. You can use the RAM user or RAM role to grant RAM permissions and RBAC permissions to other RAM users or RAM roles.
Error codes for insufficient permissions
If you do not have the required permissions when you use the ACS console or call the ACS API to perform an operation, the ACS console or API returns an error code that indicates the required permissions. The following table describes the error codes that indicate the required RBAC permissions on the cluster.
Error code or error message | Required RBAC permission on the cluster |
ForbiddenCheckControlPlaneLog | Administrator or O&M engineer permissions. |
ForbiddenHelmUsage | Administrator permissions. |
ForbiddenRotateCert | Administrator permissions. |
ForbiddenQueryClusterNamespace | Administrator, O&M engineer, developer, or restricted user permissions. |