I would like to grant one user only the "get" privilege of "kubectl" command. I suppose it should be done with RBAC, anyone can advise it, thanks.
Create a allow-get.yaml
file with the next content and change my-user
by your user, and run kubectl apply -f allow-get.yaml
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: allow-get
rules:
- apiGroups:
- ""
resources:
- "*"
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: allow-get-bind
subjects:
- kind: User
name: my-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: allow-get