Kubernetes manifests · Scaling and access control

Role and RoleBinding

Allow a service account to read pods in one namespace.

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

Official Kubernetes manifests documentation

More scaling and access control commands

All scaling and access control commands · Kubernetes manifests cheatsheet

Was this page helpful?