すべてのプロダクト
Search
ドキュメントセンター

Container Service for Kubernetes:ACK One GitOpsに関連付けられたクラスターのRBAC権限をカスタマイズする

最終更新日:Jan 26, 2025

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権限の設定

  1. 次のYAMLテンプレートを使用して、カスタムClusterRoleを作成します。

    説明
    • ClusterRoleのname: カスタム名を入力します。

    • 実際のニーズに基づいて、apiGroupsresourcesverbなどのルールを変更します。

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      name: <your ClusterRole name>
    rules:
      - apiGroups:
          - ""
        resources:
          - pods
          - configmaps
          - endpoints
        verbs:
          - create
          - delete
  2. 次の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:
      - '*'