Setting up HTPasswd as an Identity Provider
These instructions will help you set up an Identity provider so that you can remove the temporary kubeadmin user.
-
Create an htpasswd file with two users. The
useradmin will be assigned the password that was created when you installed your cluster. The userdevuserwill be assigned the passworddevpwd. THe userdevuserwill have default permissions.mkdir -p ${OKD_LAB_PATH}/okd-creds htpasswd -B -c -b ${OKD_LAB_PATH}/okd-creds/htpasswd admin $(cat ${OKD_LAB_PATH}/okd4-install-dir/auth/kubeadmin-password) htpasswd -b ${OKD_LAB_PATH}/okd-creds/htpasswd devuser devpwd -
Now, create a Secret with this htpasswd file:
oc create -n openshift-config secret generic htpasswd-secret --from-file=htpasswd=${OKD_LAB_PATH}/okd-creds/htpasswd -
Create the Htpasswd Identity Provider:
I have provided an Identity Provider custom resource configuration located at
./Provisioning/htpasswd-cr.yamlin this project.From the root of this project run:
oc apply -f ./Provisioning/htpasswd-cr.yaml -
Make the user
admina Cluster Administrator:oc adm policy add-cluster-role-to-user cluster-admin admin -
Now, log into the web console as your new admin user to verify access. Select the
Htpasswdprovider when you log in. -
Finally, remove temporary user:
oc delete secrets kubeadmin -n kube-system