参考链接:
https://docs.openshift.org/3.6/admin_guide/manage_authorization_policy.html#admin-guide-manage-authorization-policy
http://blog.csdn.net/huqigang/article/details/77962156
1. 需要通过htpasswd命令来创建用户。创建账号为dev密码为dev的用户。
oc login -u system:admin
htpasswd -b /etc/origin/master/htpasswd dev dev
2. 创建 role ,根据集群角色来修改
oc get clusterrole edit -o yaml > clusterrole_edit.yaml
cp clusterrole_edit.yaml localrole_exampleedit.yaml
vim localrole_exampleedit.yaml
# 1. Update kind: ClusterRole to kind: Role
# 2. Remove resourceVersion, selfLink, uid, and creationTimestamp
oc create -f path/to/localrole_exampleedit.yaml -n <project_you_want_to_add_the_local_role_exampleview_to>
3. 授权角色给用户
oc adm policy add-role-to-user edit dev
网友评论