Getting regular user and admin credentials to login to a CRC cluster

2 min read | by Jordi Prats

If we are using CRC to run a minikube-like OpenShift cluster we'll need the use oc login to connect to the cluster. If we don't have the credentials but the cluster is not deleted, we can still retrieve them

To retrieve the regular user and the admin credentials we can use the crc console command with the --credentials option:

$ crc console --credentials
To login as a regular user, run 'oc login -u developer -p developer https://api.crc.testing:6443'.
To login as an admin, run 'oc login -u kubeadmin -p N2fKS-tqRXY-MZ8jj-RM2Gw https://api.crc.testing:6443'

This command is going to show us the credentials we need to use, if we want to automate it we could use a simple one-liner for that.

To connect using the admin credentials we can use the following command

crc console --credentials | grep admin | grep -Eo "oc login[^\']*" | bash

On the other hand, to connect using the regular user we can use:

crc console --credentials | grep regular | grep -Eo "oc login[^\']*" | bash

Posted on 25/08/2022