It’s always bit of confusing about OpenShift 4 :D here’s how we can add user in OpenShift 4.
- Create htpasswd file as below and users and their passwords,
$ htpasswd -cb users.htpasswd user1 user1pass
$ htpasswd -b users.htpasswd user2 user2pass
Through console, login with
kube:adminuser, navigate toAdministration > Cluster Settings > Global ConfigurationClick on
Edit YAMLin front ofOauthClick on
Overview, underIdentity Providerssection, Click onAddand selectHTPasswdput name as
htpasswd, mapping method asaddand select file which we created earlier using htpasswd.Check
Yamlsection and verify that block as following should appear underspec:
identityProviders:
- htpasswd:
fileData:
name: htpasswd-qbwc4
mappingMethod: add
name: htpasswd
type: HTPasswd
- Verify users,
$ oc login -u system:admin
$ oc get users
NAME UID FULL NAME IDENTITIES
user1 5699e114-5e0d-11e9-9a49-0a580a800045 htpasswd:avni
user2 8c932519-5e0d-11e9-9a49-0a580a800045 htpasswd:developer
- Now you can login with your new users,
for example,
oc login -u user1 -p user1pass
- Happy Hacking :)