How Do You Create a Router in OpenShift When You Get an Error about a User Being Forbidden?

Problem scenario
You are trying to create a virtual router in OpenShift.  When you run the command "oc adm router goodname" you get this error:

"error: router could not be created; could not retrieve list of security constraints to verify service account "router": securitycontextconstraints.security.openshift.io is forbidden: User "jdoe" cannot list securitycontextconstraints.security.openshift.io at the cluster scope: User "jdoe" cannot list all securitycontextconstraints.security.openshift.io in the cluster"

What should you do?

Solution
Run this command:  oc login -u system:admin

Now run your command to create a router:  oc adm router goodname

Now log back into the project with the regular user:  oc login

Leave a comment

Your email address will not be published. Required fields are marked *