Container Service for Kubernetes (ACK) の権限付与システムには、基盤となるリソースレイヤーの Resource Access Management (RAM) 権限付与と、ACK クラスターレイヤーの Role-Based Access Control (RBAC) 権限付与が含まれます。これらの 2 つのレイヤーでは、ユーザーロールごとに権限要件が異なります。このトピックでは、読み取り専用管理者、アプリケーション O&M エンジニア、アプリケーション開発者、および権限管理者のための権限付与のベストプラクティスについて説明します。
権限付与システム
ACK の権限付与システムは、RAM 権限付与と RBAC 権限付与で構成されます。RAM 権限付与は、クラウドリソースに対する権限を付与するために使用されます。RBAC 権限付与は、クラスター内の Kubernetes リソースに対する権限を付与するために使用されます。次の図は、ACK の権限付与システムを示しています。
RAM 権限付与: RAM のシステムポリシーとカスタムポリシーに基づきます。この権限付与システムは、ACK およびその他の Alibaba Cloud サービスの API 操作に対する権限を付与し、以下の O&M 操作をサポートするために使用されます。
クラスターの作成、表示、スペックアップ、削除。
ノードプールの作成、変更、スケーリング。
権限付与の管理。
クラスターの監視、ログとイベントの収集。
RBAC 権限付与: Kubernetes RBAC に基づきます。この権限付与システムは、ACK クラスター内の Kubernetes リソースに対する権限を付与し、O&M 操作をサポートするために使用されます。ほとんどの場合、RBAC 権限付与を使用して、以下の Kubernetes リソースオブジェクトの追加、削除、変更、クエリの権限を付与できます。
ワークロードリソース: Deployment、StatefulSet、DaemonSet、Job、CronJob、Pod、ReplicaSet。
ネットワークリソース: Service、Ingress、NetworkPolicy。
ストレージリソース: 永続ボリューム (PV)、永続ボリューム要求 (PVC)、StorageClass。
Namespace、ConfigMap、Secret。
前提条件
Alibaba Cloud アカウントの代わりに RAM ユーザーまたは RAM ロールが権限付与操作を実行する場合、まずその RAM ユーザーまたは RAM ロールに権限管理者の権限を付与する必要があります。これにより、そのユーザーまたはロールは他の RAM ユーザーまたは RAM ロールに権限を付与できるようになります。詳細については、「RAM ユーザーまたは RAM ロールを権限管理者として設定する」をご参照ください。
シナリオ 1: 読み取り専用管理者にクラスターリソースの表示権限を付与する
すべての名前空間で Kubernetes リソースを読み取るために必要な権限をユーザーに付与します。
RAM ユーザーまたはロールに読み取り専用管理者の権限を付与する
コンソールでの権限付与
コンソールで権限を付与する方法の詳細については、「RBAC を使用してクラスター内のリソースに対する操作を承認する」をご参照ください。
Alibaba Cloud CLI 権限付与の例
GrantPermissions OpenAPI 操作を呼び出し、
role_nameリクエストパラメーターを設定して、RAM ユーザーまたはロールに admin-view (読み取り専用管理者) 権限を付与できます。DescribeUserPermission 操作を呼び出して、RAM ユーザーまたはロールの権限をクエリできます。aliyun cs POST /permissions/users/234xxxxxxxx --header "Content-Type=application/json;" --body "[{\"cluster\":\"c24xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"is_custom\":false,\"role_name\":\"admin-view\",\"role_type\":\"cluster\"}]"Terraform 権限付与の例
resource "alicloud_cs_kubernetes_permissions" "default" { uid = alicloud_ram_user.user.id permissions { cluster = alicloud_cs_managed_kubernetes.default.id role_type = "cluster" role_name = "admin-view" namespace = "" is_custom = false is_ram_role = false } }
シナリオ 2: O&M エンジニアにクラスターおよびクラスター内のアプリケーションの権限を付与する
O&M エンジニアは、ACK クラスターとその中のアプリケーションリソースを管理および保守する必要があります。したがって、RAM と RBAC の両方の権限を付与する必要があります。
RAM 権限付与
ACK は、RAM で 2 つのシステムポリシーを提供します: AliyunCSFullAccess と AliyunCSReadOnlyAccess。
AliyunCSFullAccess は、ACK のすべての OpenAPI 操作に対する読み取りおよび書き込み権限を付与します。
AliyunCSReadOnlyAccess は、ACK のすべての OpenAPI 操作に対する読み取り専用権限を付与します。
[RAM コンソール] にログインし、必要に応じてシステムポリシーのいずれかをアタッチします。詳細については、「RAM ユーザーに権限を付与する」および「RAM ロールに権限を付与する」をご参照ください。
詳細なアクセスの制御が必要な場合は、カスタム権限付与ポリシーを作成できます。詳細については、「RAM を使用してクラスターとクラウドリソースへのアクセス権限を付与する」をご参照ください。
次のコードは、このシナリオの RAM 権限付与ポリシーの例を示しています。例のアクションの詳細については、「アクション」をご参照ください。
{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": [ "cs:GetClusters", "cs:ModifyCluster", "cs:UpgradeCluster", "cs:DescribeClusterDetail", "cs:DescribeClusterVuls", "cs:DescribeClusterSecuritySummary", "cs:DescribeClusterUserKubeconfig", "cs:RevokeK8sClusterKubeConfig", "cs:CheckControlPlaneLogEnable", "cs:DescribeClusterResources", "cs:DescribeClusterEvents", "cs:DescribeClusterLogs", "cs:GetClusterAuditProject", "cs:ListClusterChecks", "cs:GetClusterCheck", "cs:RunClusterCheck", "cs:ModifyClusterAudit", "cs:DescribeResourcesDeleteProtection", "cs:UpdateResourcesDeleteProtection", "cs:DescribeClusterNodePools", "cs:DescribeClusterNodePoolDetail", "cs:CreateClusterNodePool", "cs:ModifyClusterNodePool", "cs:UpgradeClusterNodepool", "cs:DeleteClusterNodepool", "cs:CreateAutoscalingConfig", "cs:SyncClusterNodePool", "cs:RepairClusterNodePool", "cs:AttachInstancesToNodePool", "cs:ModifyNodePoolNodeConfig", "cs:DescribeClusterNodes", "cs:RemoveClusterNodes", "cs:RemoveNodePoolNodes", "cs:DiagnoseClustersNode", "cs:DescribeNodePoolVuls", "cs:FixNodePoolVuls", "cs:DrainNodes", "cs:DescribeClusterAddonMetadata", "cs:DescribeClusterAddonsVersion", "cs:InstallClusterAddons", "cs:UpgradeClusterAddons", "cs:ModifyClusterAddon", "cs:UnInstallClusterAddons", "cs:DescribeClusterAddonInstance", "cs:DescribeClusterAddonsUpgradeStatus", "cs:DescribeClusterAddonUpgradeStatus", "cs:ListClusterComponent", "cs:GetClusterComponent", "cs:DescribePolicyInstances", "cs:DeployPolicyInstance", "cs:ModifyPolicyInstance", "cs:DeletePolicyInstance", "cs:DescribePolicyGovernanceInCluster", "cs:DescribePolicyInstancesStatus", "cs:UpdateContactGroupForAlert", "cs:StartAlert", "cs:StopAlert", "cs:ListAlertRules", "cs:GetAlertHistory", "cs:DescribeClusterTasks", "cs:GetClusterBasicInfo", "cs:ListClusterReportSummary", "cs:GetClusterReportSummary", "cs:ListReportTaskRule", "cs:CreateTrigger", "cs:DescribeKubernetesClusterHookTrigger", "cs:CreateDiagnose", "cs:CreateClusterOverviewReport", "cs:GetAIDiagnosisResult", "cs:CreateReportTaskRule", "cs:CreateClusterReport", "cs:GetClusterCheckResult", "cs:GetClusterServices", "cs:UpdateControlPlaneLog", "cs:UpdateClusterName" ], "Resource": "acs:cs:*:*:cluster/xxxxx" # xxxxx をクラスター ID に置き換えます。 }, { "Effect": "Allow", "Action": [ "cs:DescribeSubAccountHelmPermission", "cs:CheckServiceRole", "cs:DeleteTriggerHook", "cs:QueryAlertContact", "cs:QueryAlertContactGroup", "cs:AddOrUpdateAlertContact", "cs:AddOrUpdateAlertContactGroup", "cs:DeleteAlertContact", "cs:DeleteAlertContactGroup", "cs:DescribeKubernetesVersionMetadata", "cs:ListOperationPlans", "cs:DescribeClusterEndpoints", "cs:DescribeTaskInfo", "cs:DescribeEvents", "cs:DescribeUserQuota", "cs:DescribeTasks", "cs:PauseTask", "cs:CancelTask", "cs:DescribeAddons", "cs:DeleteReportTaskRule", "cs:CreateSessionMessage", "cs:DescribePolicies", "cs:DescribePolicyDetails" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "vpc:DescribeVSwitches", "vpc:DescribeVpcs", "vpc:DescribeEipAddresses" ], "Resource": "*" }, { "Effect": "Allow", "Action": "kms:ListKeys", "Resource": "*" }, { "Effect": "Allow", "Action": [ "arms:ListDashboards", "arms:InstallAddon" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "cloudshell:CreateEnvironment", "cloudshell:AttachStorage", "cloudshell:DetachStorage", "cloudshell:CreateSession" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ess:DescribeScalingActivities", "ess:DescribeScalingActivityDetail", "ess:DescribeLifecycleActions" ], "Resource": "*" }, { "Effect": "Allow", "Action": "oos:ListExecutions", "Resource": "*" }, { "Effect": "Allow", "Action": [ "ecs:DescribeKeyPairs", "ecs:DescribeInstances", "ecs:DescribeSecurityGroups", "ecs:DescribeImages", "ecs:DescribePrice" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "cr:ListInstance", "cr:ListInstanceDomain", "cr:ListRepository", "cr:ListArtifactTag" ], "Resource": "*" }, { "Effect": "Allow", "Action": "ram:GetRole", "Resource": "acs:ram:*:*:role/aliyuncisdefaultrole" }, { "Effect": "Allow", "Action": [ "log:GetDashboard", "log:GetSavedSearch", "log:GetLogStore", "log:GetIndex", "log:UpdateIndex", "log:GetLogStoreLogs", "log:CreateDashboardSharing", "log:ListProject", "log:GetProjectLogs", "log:GetResourceRecord", "log:CreateResourceRecord", "log:UpdateResourceRecord" ], "Resource": "*" } ] }ACK OpenAPI の詳細については、「[製品変更] Container Service OpenAPI 認証の最適化に関するお知らせ」および「API 概要」をご参照ください。
RBAC 権限付与
RAM 権限を付与した後、対応するクラスターに対する RBAC 権限も RAM ユーザーまたは RAM ロールに付与する必要があります。ACK は、クラスターレイヤーで 5 つの事前設定されたロールを提供します。
[ACK コンソール] にログインします。左側のナビゲーションウィンドウで、[権限付与] をクリックします。
承認 ページで、[RAM ユーザー] または RAM ロール タブを選択します。管理する権限付与オブジェクトを見つけ、[アクション] 列の アクセス権限の管理 をクリックします。
表示されるパネルで、[+ 権限の追加] をクリックし、ターゲットクラスターとその名前空間の権限を [O&M エンジニア] に設定し、[承認の送信] をクリックして設定を完了します。

事前設定されたロールをアタッチすると、ACK は権限付与オブジェクトの ID に対応する ClusterRoleBinding インスタンスをクラスター内に自動的に作成します。次のコードは、事前設定された O&M エンジニアロールの RBAC 権限を示しています。
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: cs:ops rules: - apiGroups: [""] resources: ["pods", "pods/attach", "pods/exec", "pods/portforward", "pods/proxy"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: [""] resources: ["configmaps", "endpoints", "persistentvolumeclaims", "replicationcontrollers", "replicationcontrollers/scale", "secrets", "serviceaccounts", "services", "services/proxy"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: [""] resources: ["bindings", "events", "limitranges", "namespaces/status", "replicationcontrollers/status", "pods/log", "pods/status", "resourcequotas", "resourcequotas/status", "componentstatuses"] verbs: ["get", "list", "watch"] - apiGroups: [""] resources: ["namespaces", "nodes", "persistentvolumes"] verbs: ["get", "list", "watch", "patch"] - apiGroups: ["coordination.k8s.io"] resources: ["leases"] verbs: ["get"] - apiGroups: ["apps"] resources: ["daemonsets", "deployments", "deployments/rollback", "deployments/scale", "replicasets", "replicasets/scale", "statefulsets"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["autoscaling"] resources: ["horizontalpodautoscalers"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["batch"] resources: ["cronjobs", "jobs"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["extensions"] resources: ["daemonsets", "deployments", "deployments/rollback", "deployments/scale","ingresses","replicasets", "replicasets/scale", "replicationcontrollers/scale"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["networking.k8s.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["servicecatalog.k8s.io"] resources: ["clusterserviceclasses", "clusterserviceplans", "clusterservicebrokers", "serviceinstances", "servicebindings"] verbs: ["create", "delete", "get", "list", "patch", "update", "watch"] - apiGroups: ["servicecatalog.k8s.io"] resources: ["clusterservicebrokers/status", "clusterserviceclasses/status", "clusterserviceplans/status", "serviceinstances/status", "serviceinstances/reference", "servicebindings/status"] verbs: ["update"] - apiGroups: ["storage.k8s.io"] resources: ["storageclasses"] verbs: ["get", "list", "watch"] - apiGroups: ["alicloud.com"] resources: ["*"] verbs: ["create", "delete", "get", "list", "patch", "update", "watch"] - apiGroups: ["policy"] resources: ["poddisruptionbudgets"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["metrics.k8s.io"] resources: ["pods", "nodes"] verbs: ["get", "watch", "list"] - apiGroups: ["networking.istio.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["config.istio.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["rbac.istio.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["istio.alibabacloud.com"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["authentication.istio.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["log.alibabacloud.com"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["monitoring.kiali.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["kiali.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["apiextensions.k8s.io"] resources: ["customresourcedefinitions"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["serving.knative.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["eventing.knative.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["messaging.knative.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["sources.eventing.knative.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["tekton.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["alert.alibabacloud.com"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"]詳細な RBAC アクセスの制御が必要な場合は、カスタム ClusterRole インスタンスを作成できます。詳細については、Kubernetes ドキュメントの「RBAC」をご参照ください。次に、[Container Service for Kubernetes コンソール] の [権限管理] ページで、[カスタムロール] を選択し、ドロップダウンリストからカスタム ClusterRole の名前を選択します。詳細については、「カスタム RBAC を使用してクラスター内のリソースに対する操作を制限する」をご参照ください。
シナリオ 3: クラスター内のアプリケーション開発者に権限を付与する
開発者は、ACK クラスター内の Kubernetes リソースオブジェクトを管理する権限 (RBAC 権限付与) と、ターゲットクラスターに対する読み取り専用権限 (RAM 権限付与) のみが必要です。開発者は、クラウドリソースへのアクセス権限は必要ありません。
RBAC 権限を付与する前に、権限付与オブジェクトはターゲットクラスターに対する少なくとも読み取り専用権限 (RAM 権限付与) を持っている必要があります。
RAM 権限付与
[RAM コンソール] で、カスタムポリシーを作成し、そのポリシーをターゲットの RAM ユーザーまたは RAM ロールにアタッチします。詳細については、「RAM を使用してクラスターとクラウドリソースへのアクセス権限を付与する」をご参照ください。次のコードは、カスタムポリシーの内容を示しています。
{ "Statement": [ { "Action": [ "cs:GetClusters", "cs:DescribeClusterDetail", "cs:GetClusterAuditProject", "cs:DescribeResourcesDeleteProtection" ], "Resource": "acs:cs:*:*:cluster/xxxxx", # これを実際のクラスター ID に置き換えます。 "Effect": "Allow" } ], "Version": "1" }説明権限付与オブジェクトにすべてのクラスターに対する読み取り専用権限を付与するには、ACK が提供する
AliyunCSReadOnlyAccessシステムポリシーをオブジェクトにアタッチできます。RBAC 権限付与
[ACK コンソール] にログインします。左側のナビゲーションウィンドウで、[権限付与] をクリックします。
承認 ページで、[RAM ユーザー] または RAM ロール タブを選択します。管理する権限付与オブジェクトを見つけ、[アクション] 列の アクセス権限の管理 をクリックします。
表示されるパネルで、[+ 権限の追加] をクリックし、ターゲットクラスターとその名前空間の権限を [開発者] に設定し、[承認の送信] をクリックして設定を完了します。

事前設定されたロールをアタッチすると、ACK は権限付与オブジェクトの ID に対応する ClusterRoleBinding インスタンスをクラスター内に自動的に作成します。次のコードは、事前設定された開発者ロールの RBAC 権限を示しています。
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: cs:ns:dev rules: - apiGroups: [""] resources: ["pods", "pods/attach", "pods/exec", "pods/portforward", "pods/proxy"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: [""] resources: ["configmaps", "endpoints", "persistentvolumeclaims", "replicationcontrollers", "replicationcontrollers/scale", "secrets", "serviceaccounts", "services", "services/proxy"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: [""] resources: ["events", "replicationcontrollers/status", "pods/log", "pods/status"] verbs: ["get", "list", "watch"] - apiGroups: ["apps"] resources: ["daemonsets", "deployments", "deployments/rollback", "deployments/scale", "replicasets", "replicasets/scale", "statefulsets"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["autoscaling"] resources: ["horizontalpodautoscalers"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["batch"] resources: ["cronjobs", "jobs"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["extensions"] resources: ["daemonsets", "deployments", "deployments/rollback", "deployments/scale","ingresses","replicasets", "replicasets/scale", "replicationcontrollers/scale"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["networking.k8s.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["servicecatalog.k8s.io"] resources: ["clusterserviceclasses", "clusterserviceplans", "clusterservicebrokers", "serviceinstances", "servicebindings"] verbs: ["create", "delete", "get", "list", "patch", "update", "watch"] - apiGroups: ["servicecatalog.k8s.io"] resources: ["clusterservicebrokers/status", "clusterserviceclasses/status", "clusterserviceplans/status", "serviceinstances/status", "serviceinstances/reference", "servicebindings/status"] verbs: ["update"] - apiGroups: ["alicloud.com"] resources: ["*"] verbs: ["create", "delete", "get", "list", "patch", "update", "watch"] - apiGroups: ["policy"] resources: ["poddisruptionbudgets"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["networking.istio.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["config.istio.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["rbac.istio.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["istio.alibabacloud.com"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["authentication.istio.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["log.alibabacloud.com"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["monitoring.kiali.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["kiali.io"] resources: ["*"] verbs: ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"] - apiGroups: ["apiextensions.k8s.io"] resources: ["customresourcedefinitions"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["serving.knative.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["eventing.knative.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["messaging.knative.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["sources.eventing.knative.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["tekton.dev"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"] - apiGroups: ["alert.alibabacloud.com"] resources: ["*"] verbs: ["get", "list", "create", "watch", "patch", "update", "delete", "deletecollection"]詳細な RBAC アクセスの制御が必要な場合は、カスタム ClusterRole インスタンスを作成できます。詳細については、Kubernetes ドキュメントの「RBAC」をご参照ください。次に、[Container Service for Kubernetes コンソール] の [権限管理] ページで、[カスタムロール] を選択し、ドロップダウンリストからカスタム ClusterRole の名前を選択します。詳細については、「カスタム RBAC を使用してクラスター内のリソースに対する操作を制限する」をご参照ください。
シナリオ 4: クラスター内のアプリケーションの権限管理者に権限を付与する
権限管理者は、他の RAM ユーザーまたは RAM ロールの RBAC 権限を管理する必要があります。デフォルトでは、RAM ユーザーまたは RAM ロールには、他の RAM ユーザーまたは RAM ロールに RBAC 権限を付与する権限がありません。権限管理者が [Container Service for Kubernetes コンソール] の [権限管理] ページに移動したときに、現在の RAM ユーザーには権限管理権限がありません。Alibaba Cloud アカウントまたは権限管理者に連絡して権限を付与してください。 というメッセージが表示された場合、その管理者には必要な RAM 権限またはクラスターの RBAC 管理者権限がないことを示します。
RAM 権限付与
権限管理者に必要な RAM 権限が付与されていることを確認してください。ポリシーには、次の操作を実行するための権限が含まれている必要があります。
他の RAM ユーザーまたは RAM ロールをリスト表示する。
指定された RAM ユーザーまたは RAM ロールの Kubernetes RBAC 権限設定を表示する。
Kubernetes RBAC 権限を付与する。
[RAM コンソール] にログインし、指定された RAM ユーザーまたは RAM ロールに必要な RAM 権限を付与します。詳細については、「RAM を使用してクラスターとクラウドリソースへのアクセス権限を付与する」をご参照ください。次のコードは、カスタム RAM ポリシーの例を示しています。
{ "Statement": [ { "Action": [ "ram:ListRoles", "ram:ListUserBasicInfos", "cs:GetClusters", "cs:DescribeUserPermission", "cs:DescribeClusterDetail", "cs:GrantPermissions", "cs:UpdateUserPermissions", "cs:GetClusterAuditProject", "cs:DescribeResourcesDeleteProtection", "cs:UpdateResourcesDeleteProtection", "cs:DescribeClusterAddonUpgradeStatus" ], "Resource": "*", "Effect": "Allow" } ], "Version": "1" }RBAC 権限付与
[ACK コンソール] にログインします。左側のナビゲーションウィンドウで、[権限付与] をクリックします。
承認 ページで、[RAM ユーザー] または RAM ロール タブを選択します。管理する権限付与オブジェクトを見つけ、[アクション] 列の アクセス権限の管理 をクリックします。
表示されるパネルで、ロール権限の追加 をクリックし、ターゲットクラスターとその名前空間の権限を Admin または
cluster-adminカスタムロールに設定し、[承認の送信] をクリックして設定を完了します。
説明デフォルトでは、Alibaba Cloud アカウントとクラスター作成者には
cluster-adminロールが付与されます。このロールは、クラスター内のすべての Kubernetes リソースオブジェクトへのアクセス権限を付与します。
上記の RAM および RBAC 権限を権限管理者に付与すると、管理者は指定された範囲内で他の RAM ユーザーまたは RAM ロールの RBAC 権限を管理できるようになります。詳細については、「RBAC を使用してクラスター内のリソースに対する操作を承認する」をご参照ください。