Skip to content

Instantly share code, notes, and snippets.

@adrianescutia
Last active April 6, 2022 19:02
Show Gist options
  • Save adrianescutia/6b5107f3e5f9cd96fbeb1f5390561c43 to your computer and use it in GitHub Desktop.
Save adrianescutia/6b5107f3e5f9cd96fbeb1f5390561c43 to your computer and use it in GitHub Desktop.
Role and RoleBinding for OpenShift (and Kubernetes) to get the pods and logs ONLY
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: logging-user:list-and-logs
namespace: YOUR-NAMESPACE
rules:
- apiGroups:
- ''
resources:
- pods
- pods/log
verbs:
- get
- watch
- list
- verbs:
- get
apiGroups:
- ''
resources:
- namespaces
- verbs:
- get
apiGroups:
- ''
- project.openshift.io
resources:
- projects
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: 'logging-user:logs'
namespace: YOUR-NAMESPACE
subjects:
- kind: User
apiGroup: rbac.authorization.k8s.io
name: logging-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: 'logging-user:list-and-logs'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment