Skip to content

Add first admin and limited user

khodayard edited this page Apr 15, 2020 · 3 revisions

Admin user

You won't be able to login in your cluster when installation is complete because we have chosen htpasswd authentication method, there's a few more authentication method for openshift and default is to allow all methods which will create a user for each login without needing a password at all. So I've set it to htpasswd. You can read more about it here.

Important Note

When you choose htpasswd as authentication method it's important to keep in mind that you have 3 nodes and you'll have to sync htpassd file on all of these servers manually so that your newly created user will be able to login using your user/pass.

To create your admin user, login to your first master node (mst01.okd.lcl in this case) and run these commands.

[root@mst01 ~]# htpasswd -b /etc/origin/master/htpasswd admin PASSWORD

Sync it with other master nodes:

[root@mst01 ~]# scp /etc/origin/master/htpasswd mst02:/etc/origin/master/
[root@mst01 ~]# scp /etc/origin/master/htpasswd mst03:/etc/origin/master/

Make this user a real admin:

[root@mst01 ~]# oc adm policy add-cluster-role-to-user cluster-admin admin

Now you can login with this user/pass to api or web console.

Limited user

You will just need to add the user to htpasswd file and sync it over your master cluster:

[root@mst01 ~]# htpasswd -b /etc/origin/master/htpasswd khodayar PASSWORD
[root@mst01 ~]# scp /etc/origin/master/htpasswd mst02:/etc/origin/master/
[root@mst01 ~]# scp /etc/origin/master/htpasswd mst03:/etc/origin/master/

et c'est tout pour le moment :)