Reputation: 3014
Is there an equivalent for the following command in yaml? Using OpenShift 4.2 currently
oc adm policy add-scc-to-user <scc_name> <user_name>
Upvotes: 1
Views: 1987
Reputation: 18030
This command creates rol ebinding (if you omit namespace it creates cluster role binding) :
$ oc adm policy add-scc-to-user anyuid -z default -n your-namespace
clusterrole.rbac.authorization.k8s.io/system:openshift:scc:anyuid added: "default"
You can do this by using the similar yaml
(this one is for default
serviceAccount and anyuid
scc, but should be similar for others):
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: 'system:openshift:scc:anyuid'
namespace: <your-namespace>
subjects:
- kind: ServiceAccount
name: default
namespace: <your-namespace>
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: 'system:openshift:scc:anyuid'
Upvotes: 1