kubernetes-guide/codeblock/rbac/limit-sa.yaml

32 lines
548 B
YAML

apiVersion: v1
kind: ServiceAccount
metadata:
name: build-robot
namespace: build
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: build
name: pod-reader
rules:
- apiGroups: [""]
resources: ["pods", "pods/log"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: read-pods
namespace: build
subjects:
- kind: ServiceAccount
name: build-robot
namespace: build
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io