OpenShift - Disable new Project creation using projectRequestMessage

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

By default, once a user has signed into OpenShift, they are allowed to create new projects. This can be disabled in the following ways:


Edit the project.config.openshift.io/cluster resource.

oc edit project.config.openshift.io/cluster

 

And add projectRequestMessage. This might be something you want to do in a scenario where you have some other method for creating projects, such as with an orchestration technology such as Terraform.

spec:
  projectRequestMessage: New project creation has been disabled

 

The pods in the openshift-apiserver namespace should automatically restart. After each pod has restarted, the change should be live.

~]$ oc get pods --namespace openshift-apiserver
NAME                         READY   STATUS        RESTARTS   AGE
apiserver-59c8df77f6-qpzmx   0/2     Pending       0          41s
apiserver-846d775c67-kjjdx   2/2     Running       0          44d
apiserver-846d775c67-r8n5c   2/2     Terminating   0          44d
apiserver-846d775c67-wj665   2/2     Running       0          44d

 

Let use the oc new-project to try to create a new project.

oc new-project my-project

 

And something like this should be returned.

~]$ oc new-project my-project
Error from server (Forbidden): New project creation has been disabled

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 95635 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |