Page 39 on the PDF itself from DO380 guide
Say I created below YAML file and ran it. Now I want to add another serviceaccount named "tom" to the clusterrole. The serviceaccount of "Tom" is created.
oc adm policy add-cluster-role-to-user auditor -z tom (maybe this is not the correct way to do it?)
How do I view the serviceaccount named "Tom" is associated with the clusterrole called "auditor"?
apiVersion: v1
kind: ServiceAccount
metadata:
name: auditor
namespace: automation-scripts
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: auditor
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: auditor
subjects:
- kind: ServiceAccount
name: auditor
namespace: automation-scripts
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: auditor
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.