Skip to content
Role based access control (RBACs) in k8s

icon picker
Service Account

Service+Accounts+in+Kubernetes+Cluster.pdf
376.6 kB

If any pod has to access k8s api then a service account need to be created.

Creating a Service Account
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-serviceaccount
namespace: development
automountServiceAccountToken: false

Assigning the service account using rolebinding
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: sa-pod-reader
namespace: development
subjects:
- kind: ServiceAccount
name: my-serviceaccount
namespace: development
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.