הרשאות ברירת המחדל של סנכרון תצורות

בדף הזה מפורטות הרשאות ברירת המחדל ש-סנכרון תצורות והרכיבים שלו צריכים כדי לקבל גישה נכונה ברמת האשכול.

הרשאות ברירת מחדל

בטבלה הבאה מפורטות ההרשאות שמופעלות כברירת מחדל ב-סנכרון תצורות. לא מומלץ להשבית את ההרשאות האלה בזמן שמשתמשים בסנכרון תצורות.

רכיב מרחב שמות חשבון שירות הרשאות תיאור
reconciler-manager config-management-system reconciler-manager cluster-admin כדי להקצות את ה-reconcilers ברמת הבסיס וליצור את ClusterRoleBinding עבור ה-reconcilers ברמת הבסיס, למשתמש reconciler-manager צריכה להיות הרשאה מסוג cluster-admin.
root reconcilers config-management-system השם של כלי ההתאמה ברמת הבסיס cluster-admin כדי להחיל משאבים בהיקף אשכול ומשאבים בהתאמה אישית, למנגנוני הגישור ברמת הבסיס צריכה להיות הרשאה cluster-admin.
namespace reconcilers config-management-system השם של רכיב ה-reconciler של מרחב השמות configsync.gke.io:ns-reconciler כדי לקבל ולעדכן את האובייקטים RepoSync ו-ResourceGroup ואת הסטטוסים שלהם, ל-reconcilers של מרחב השמות נדרשת ההרשאה configsync.gke.io:ns-reconciler.
resource-group-controller-manager config-management-system resource-group-sa כדי לבדוק את סטטוס האובייקט ולהפעיל את בחירת המנהיג, ל-resource-group-controller-manager צריכות להיות ההרשאות resource-group-manager-role ו-resource-group-leader-election-role.
admission-webhook config-management-system admission-webhook cluster-admin כדי לדחות בקשות לכל אובייקט באשכול, ל-webhook של בקרת הכניסה צריכות להיות הרשאות cluster-admin.
importer config-management-system importer cluster-admin כדי להגדיר הרשאות RBAC, ל-importer צריכה להיות הרשאת cluster-admin.

הרשאות ספציפיות לסנכרון תצורות

בקטעים הבאים מפורטות ההרשאות configsync.gke.io:ns-reconciler ו-resource-group-manager-role resource-group-leader-election-role שמופיעות בטבלה הקודמת.

‫סנכרון תצורות מחיל את ההרשאות האלה באופן אוטומטי על ידי הכללת ClusterRoles הבאים במניפסטים של Namespace Reconciler ו-Resource Group Controller.

RBAC עבור כלי סנכרון של מרחבי שמות

בדוגמה הבאה של ClusterRole מוצגות הרשאות של בקרת גישה מבוססת-תפקידים (RBAC) עבור רכיבי namespace reconciler:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: configsync.gke.io:ns-reconciler
  labels:
    configmanagement.gke.io/system: "true"
    configmanagement.gke.io/arch: "csmr"
rules:
- apiGroups: ["configsync.gke.io"]
  resources: ["reposyncs"]
  verbs: ["get"]
- apiGroups: ["configsync.gke.io"]
  resources: ["reposyncs/status"]
  verbs: ["get","list","update"]
- apiGroups: ["kpt.dev"]
  resources: ["resourcegroups"]
  verbs: ["*"]
- apiGroups: ["kpt.dev"]
  resources: ["resourcegroups/status"]
  verbs: ["*"]
- apiGroups:
  - policy
  resources:
  - podsecuritypolicies
  resourceNames:
  - acm-psp
  verbs:
  - use

RBAC for Resource Group Controller

בדוגמה הבאה של ClusterRole מוצגות ההרשאות של בקרת הגישה מבוססת-התפקידים (RBAC) עבור בקר קבוצת המשאבים:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  creationTimestamp: null
  labels:
    configmanagement.gke.io/arch: "csmr"
    configmanagement.gke.io/system: "true"
  name: resource-group-manager-role
rules:
# This permission is needed to get the status for managed resources
- apiGroups:
  - '*'
  resources:
  - '*'
  verbs:
  - get
  - list
  - watch
# This permission is needed to watch/unwatch types as they are registered or removed.
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs:
  - get
  - list
  - watch
# This permission is needed so that the ResourceGroup Controller can reconcile a ResourceGroup CR
- apiGroups:
  - kpt.dev
  resources:
  - resourcegroups
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
# This permission is needed so that the ResourceGroup Controller can update the status of a ResourceGroup CR
- apiGroups:
  - kpt.dev
  resources:
  - resourcegroups/status
  verbs:
  - get
  - patch
  - update
# This permission is needed so that the ResourceGroup Controller can work on a cluster with PSP enabled
- apiGroups:
  - policy
  resourceNames:
  - acm-psp
  resources:
  - podsecuritypolicies
  verbs:
  - use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  labels:
    configmanagement.gke.io/arch: "csmr"
    configmanagement.gke.io/system: "true"
  name: resource-group-leader-election-role
  namespace: resource-group-system
rules:  // The following permissions are needed so that the leader election can work
- apiGroups:
  - ""
  resources:
  - configmaps
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - ""
  resources:
  - configmaps/status
  verbs:
  - get
  - update
  - patch
- apiGroups:
  - ""
  resources:
  - events
  verbs:
  - create
- apiGroups:
  - coordination.k8s.io
  resources:
  - leases
  verbs:
  - '*'