Registered clusters access cluster resources through the ack-cluster-agent component, and all operation permissions are scoped to the ack ServiceAccount created during ack-cluster-agent installation. Restricted mode and administrator mode are available. This topic describes the RBAC permissions required by ack-cluster-agent in a registered cluster.ack
ServiceAccount to control ACK console access in your registered cluster.
Two base permission modes:
| Mode | Console capabilities | When to use |
|---|---|---|
| Restricted mode | Workload visibility is unavailable. Component management and services such as Managed Service for Prometheus (Prometheus) and Simple Log Service (SLS) are available through onectl. | Least-privilege environments |
| Administrator mode | All console features are available | Full console access required |
Additional permissions are required to install components, create node pools, enable log queries, or view resources in read-only mode.
Prerequisites
Ensure the following:
-
ack-cluster-agent version 1.13.1.105-g8ee9abb-aliyun or later is installed. See Manage components.
Grant restricted mode permissions
Restricted mode needs read access to ConfigMaps in the kube-system and kube-public namespaces. Apply these Roles and RoleBindings:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: ack-agent-create-cm-role
namespace: kube-system
labels:
ack/creator: "ack"
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: ack-agent-update-cm-role
namespace: kube-system
labels:
ack/creator: "ack"
rules:
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
- ack-agent-config
- provider
verbs:
- update
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: ack-agent-read-cm-role
namespace: kube-public
labels:
ack/creator: "ack"
rules:
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
- kube-root-ca.crt
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ack-agent-create-cm-rolebinding
namespace: kube-system
labels:
ack/creator: "ack"
subjects:
- kind: ServiceAccount
name: ack
namespace: kube-system
roleRef:
kind: Role
name: ack-agent-create-cm-role
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ack-agent-update-cm-rolebinding
namespace: kube-system
labels:
ack/creator: "ack"
subjects:
- kind: ServiceAccount
name: ack
namespace: kube-system
roleRef:
kind: Role
name: ack-agent-update-cm-role
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ack-agent-read-cm-rolebinding
namespace: kube-public
labels:
ack/creator: "ack"
subjects:
- kind: ServiceAccount
name: ack
namespace: kube-system
roleRef:
kind: Role
name: ack-agent-read-cm-role
apiGroup: rbac.authorization.k8s.io
---
In restricted mode, workload visibility is unavailable. To manage components and access services such as Prometheus and SLS, use onectl. onectl temporarily elevates to administrator permissions and revokes them on completion or interruption.
Grant administrator mode permissions
Administrator mode grants full access to all cluster resources. Apply this ClusterRole to the ack ServiceAccount:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ack-admin
labels:
ack/creator: "ack"
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
Grant permissions for component management
Installing or updating components such as terway-eniip or logtail-ds requires temporary administrator permissions. Follow this workflow:
Step 1: Elevate to administrator permissions
Apply the ClusterRole from Grant administrator mode permissions.
Step 2: Install or update the component
Install or update the component.
Step 3: Restore least permissions
After the install or update, restore the ClusterRole to least permissions:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ack-admin
labels:
ack/creator: "ack"
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get","list","watch"]
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["ack-agent-config","provider"]
verbs: ["get","list","watch","update"]
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["autoscaler-meta"]
verbs: ["get","list","watch","update"]
- apiGroups: ["*"]
resources: ["daemonsets", "deployments"]
resourceNames: ["terway-eniip","security-inspector","ack-cluster-agent","gatekeeper","ack-virtual-node","metrics-server","logtail-ds","resource-controller","aliyun-acr-credential-helper","migrate-controller","ack-kubernetes-cronhpa-controller","tiller-deploy"]
verbs: ["get", "list", "watch"]
- apiGroups: ["*"]
resources: ["daemonsets", "deployments"]
resourceNames: ["cluster-autoscaler"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: [""]
resources: ["pods","secrets"]
verbs: ["list"]
Grant permissions for node pool creation
Installing Terway or creating node pools also requires temporary administrator permissions. Follow this elevate-then-restore workflow:
Step 1: Elevate to administrator permissions
Apply the ClusterRole from Grant administrator mode permissions.
Step 2: Create the node pool or install Terway
Create the node pool or install Terway.
Step 3: Restore least permissions
After the operation, restore the ClusterRole to least permissions:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ack-admin
labels:
ack/creator: "ack"
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get","list","watch"]
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["ack-agent-config","provider","autoscaler-meta","eni-config"]
verbs: ["get","list","watch","update"]
- apiGroups: ["*"]
resources: ["daemonsets", "deployments"]
resourceNames: ["terway-eniip", "cluster-autoscaler"]
verbs: ["get", "list", "watch", "update"]
Grant permissions for SLS log queries
After enabling SLS in the registered cluster, apply this ClusterRole and ClusterRoleBinding to query logs in the ACK console:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ack-agent-role-log
labels:
ack/creator: "ack"
rules:
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get","list","watch"]
- apiGroups: ["apps"]
resources: ["daemonsets", "deployments"]
resourceNames: ["alibaba-log-controller", "logtail-ds", "kube-proxy-master"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["alibaba-log-configuration"]
verbs: ["get","list","watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ack-agent-binding-log
labels:
ack/creator: "ack"
subjects:
- kind: ServiceAccount
name: ack
namespace: kube-system
roleRef:
kind: ClusterRole
name: ack-agent-role-log
apiGroup: rbac.authorization.k8s.io
Grant read-only permissions
Apply this ClusterRole and ClusterRoleBinding to view Kubernetes resources in the ACK console without making changes:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ack-readonly-clusterrole
rules:
- apiGroups:
- ""
resources:
- nodes
- namespaces
- pods
- pods/log
- pods/exec
- configmaps
- endpoints
- events
- limitranges
- persistentvolumeclaims
- podtemplates
- replicationcontrollers
- resourcequotas
- serviceaccounts
- services
verbs:
- get
- list
- apiGroups:
- apps
resources:
- deployments
- daemonsets
- statefulsets
- replicasets
verbs:
- get
- list
- apiGroups:
- batch
resources:
- jobs
- cronjobs
verbs:
- get
- list
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- get
- list
- apiGroups:
- events.k8s.io
resources:
- events
verbs:
- get
- list
- apiGroups:
- extensions
resources:
- daemonsets
- deployments
- ingresses
- networkpolicies
- replicasets
verbs:
- get
- list
- apiGroups:
- networking.k8s.io
resources:
- ingresses
- networkpolicies
verbs:
- get
- list
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- get
- list
- apiGroups:
- rbac.authorization.k8s.io
resources:
- rolebindings
- roles
verbs:
- get
- list
- apiGroups:
- storage.k8s.io
resources:
- csistoragecapacities
verbs:
- get
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ack-readonly-clusterrolebinding
labels:
ack/creator: "ack"
subjects:
- kind: ServiceAccount
name: ack
namespace: kube-system
roleRef:
kind: ClusterRole
name: ack-readonly-clusterrole
apiGroup: rbac.authorization.k8s.io