FIX(app): add ServiceAccount and RBAC configuration
- Create ServiceAccount, ClusterRole, ClusterRoleBinding - Grant permissions for mas agent to access K8s resources
This commit is contained in:
@@ -4,6 +4,7 @@ kind: Kustomization
|
||||
resources:
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- serviceaccount.yaml
|
||||
|
||||
commonLabels:
|
||||
app.kubernetes.io/name: mas
|
||||
|
||||
50
deploy/k8s/base/serviceaccount.yaml
Normal file
50
deploy/k8s/base/serviceaccount.yaml
Normal file
@@ -0,0 +1,50 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: mas
|
||||
namespace: mas
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: mas-viewer
|
||||
rules:
|
||||
- apiGroups: ["", "apps", "batch", "networking.k8s.io"]
|
||||
resources: ["*"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: mas-writer
|
||||
rules:
|
||||
- apiGroups: ["", "apps", "batch", "networking.k8s.io"]
|
||||
resources: ["*"]
|
||||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: mas-viewer-binding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: mas-viewer
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: mas
|
||||
namespace: mas
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: mas-writer-binding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: mas-writer
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: mas
|
||||
namespace: mas
|
||||
|
||||
Reference in New Issue
Block a user