Skip to content

Instantly share code, notes, and snippets.

@lizrice
Created July 13, 2020 17:36
Show Gist options
  • Save lizrice/c49130102fec9f9c7ad39e04cbedff9b to your computer and use it in GitHub Desktop.
Save lizrice/c49130102fec9f9c7ad39e04cbedff9b to your computer and use it in GitHub Desktop.
Role & RoleBinding as an example for who-can
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: default
name: pod-runner
rules:
- apiGroups: [""] # "" indicates the core API group
resources: ["pods"]
verbs: ["create", "delete", "get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: read-pods
namespace: default
subjects:
- kind: User
name: Jennifer
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: pod-runner
apiGroup: rbac.authorization.k8s.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment