Distributed Cloud Container Platform for Kubernetes (ACK One) GitOpsが関連するクラスターに対して実行できる操作は、デフォルトでシステムによって作成されるClusterRole ack-mc:argocd-ackone-dev
で定義されているロールベースのアクセス制御 (RBAC) 権限によって制御されます。 これらのデフォルトの権限は変更できません。 たとえば、ACK One GitOpsが指定された関連付けられたクラスター内のポッドの作成と表示のみを許可するなど、権限をきめ細かく制御するには、ClusterRoleを作成し、適切なRBAC権限を指定します。 このトピックでは、ACK One GitOpsのデフォルトの権限と、ACK One GitOpsの権限をカスタマイズする方法について説明します。
背景情報
クラスターがACK Oneフリートインスタンスに関連付けられている場合、デフォルトのServiceAccount argocd-ackone-sa
とデフォルトのClusterRole ack-mc:argocd-ackone-dev
が関連付けられたクラスターに作成され、ClusterRoleはServiceAccountにバインドされます。 ACK One GitOpsは、デフォルトでack-mc:argocd-ackone-dev
に含まれるRBAC権限に基づいて、関連するクラスターを制御します。
ACK One GitOpsのRBAC権限をカスタマイズすることもできます。 これには、関連付けられたクラスターにカスタムのClusterRoles/Rolesを作成し、ClusterRoleBindingsまたはRoleBindingsを使用して既定のServiceAccount argocd-ackone-sa
にバインドする必要があります。
ACK One GitOpsに関連付けられたクラスターに対するRBAC権限の設定
次のYAMLテンプレートを使用して、カスタムClusterRoleを作成します。
説明ClusterRoleの
name
: カスタム名を入力します。実際のニーズに基づいて、
apiGroups
、resources
、verb
などのルールを変更します。
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: <your ClusterRole name> rules: - apiGroups: - "" resources: - pods - configmaps - endpoints verbs: - create - delete
次のYAMLテンプレートを使用してClusterRoleBindingを作成し、ClusterRoleを既定のServiceAccount
argocd-ackone-sa
にバインドし、argocd-ackone-sa
にカスタムRBAC権限を付与します。説明ClusterRoleの
名前
: 前の手順で作成したClusterRoleの名前を入力する必要があります。ServiceAccountの
name
: 名前はargocd-ackone-sa
でなければなりません。 値を変更しないでください。apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: <ClusterRoleBinding name> roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: <your ClusterRole name> subjects: - kind: ServiceAccount name: argocd-ackone-sa namespace: ack-multiple-clusters
ACK One GitOpsのデフォルト権限
システムによって作成されるデフォルトのClusterRole ack-mc:argocd-ackone-dev
には、次のRBAC権限が含まれています。
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ack-mc:argocd-ackone-dev
rules:
- apiGroups:
- ""
resources:
- pods
- configmaps
- endpoints
- persistentvolumeclaims
- replicationcontrollers
- replicationcontrollers/scale
- serviceaccounts
- services
- namespaces
- bindings
- limitranges
- resourcequotas
- persistentvolumes
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- events
- namespaces/status
- replicationcontrollers/status
- pods/status
- pods/log
- resourcequotas/status
verbs:
- get
- list
- watch
- patch
- update
- 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:
- metrics.k8s.io
resources:
- pods
verbs:
- get
- watch
- list
- apiGroups:
- networking.k8s.io
resources:
- '*'
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- 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:
- log.alibabacloud.com
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:
- alert.alibabacloud.com
resources:
- '*'
verbs:
- get
- list
- create
- watch
- patch
- update
- delete
- deletecollection
- apiGroups:
- alibabacloud.com
resources:
- externalsecrets
- secretstores
verbs:
- '*'
- apiGroups:
- apps.kruise.io
- policy.kruise.io
- rollouts.kruise.io
resources:
- '*'
verbs:
- '*'
- apiGroups:
- argoproj.io
resources:
- analysisruns
- analysistemplates
- clusteranalysistemplates
- experiments
- rollouts
verbs:
- '*'
- apiGroups:
- admissionregistration.k8s.io
resources:
- validatingwebhookconfigurations
- mutatingwebhookconfigurations
verbs:
- '*'
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- '*'