FEAT(app): add rbac and kubectl for mcp tools
- ServiceAccount for mas pod - ClusterRole with read-only permissions - ClusterRoleBinding - kubectl installed in Docker image - Now mas can query Kubernetes API!
This commit is contained in:
68
deploy/k8s/overlays/prod/serviceaccount.yaml
Normal file
68
deploy/k8s/overlays/prod/serviceaccount.yaml
Normal file
@@ -0,0 +1,68 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: mas
|
||||
namespace: mas
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: mas-viewer
|
||||
rules:
|
||||
# Read-only access to most resources
|
||||
- apiGroups: [""]
|
||||
resources:
|
||||
- pods
|
||||
- pods/log
|
||||
- services
|
||||
- endpoints
|
||||
- namespaces
|
||||
- nodes
|
||||
- persistentvolumeclaims
|
||||
- configmaps
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
- apiGroups: ["apps"]
|
||||
resources:
|
||||
- deployments
|
||||
- statefulsets
|
||||
- daemonsets
|
||||
- replicasets
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
- apiGroups: ["batch"]
|
||||
resources:
|
||||
- jobs
|
||||
- cronjobs
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
- apiGroups: ["networking.k8s.io"]
|
||||
resources:
|
||||
- ingresses
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
- apiGroups: ["argoproj.io"]
|
||||
resources:
|
||||
- applications
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
# Describe resources
|
||||
- apiGroups: [""]
|
||||
resources:
|
||||
- pods/status
|
||||
- services/status
|
||||
verbs: ["get"]
|
||||
---
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user