欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

k8s rbac 记录

程序员文章站 2024-03-13 19:46:03
...

参考:https://www.huaweicloud.com/articles/5bf22633f80c0ad49479f3c9935b2534.html

以下是一段比较通配的rbac代码:

#  (2)serviceAccount
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    k8s-app: 
  name: 
  namespace: 

   
---
#  (3)ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: 
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  - endpoints
  - persistentvolumeclaims
  - replicationcontrollers
  - replicationcontrollers/scale
  - secrets
  - serviceaccounts
  - services
  - services/proxy
  verbs:
  - create
  - delete
  - deletecollection
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - extensions
  resources:
  - daemonsets
  - deployments
  - deployments/rollback
  - deployments/scale
  - ingresses
  - networkpolicies
  - replicasets
  - replicasets/scale
  - replicationcontrollers/scale
  verbs:
  - create
  - delete
  - deletecollection
  - get
  - list
  - patch
  - update
  - watch  
  
   
---

#  (4)ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    k8s-app: 
  name: 
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: 
subjects:
- kind: ServiceAccount
  name: 
  namespace: 

相关标签: cloud native