Recovering deleted default projects in OpenShift 3.0 and 3.1

Solution Unverified - Updated -

Environment

  • OpenShift Container Platform 3.0, 3.1

Issue

  • Some of the default projects like default, openshift, or openshift-infra have been deleted. How do I recover those?
  • What happens if I delete some of the main projects/namespaces in OpenShift?
  • I want to protect my default, openshift, and openshift-infra projects from being deleted. What would I need to do if someone deletes the default, openshift, and/or openshift-infra projects/namespaces?

Resolution

Update to OpenShift 3.2 or later to prevent the system projects from being deleted. Since version 3.2, the default, openshift, and openshift-infra projects are all protected via the Kubernetes API server. Now, those projects cannot be deleted using the oc tool or kubectl.

A Request for Feature Enhancement (RFE) has been opened to add a warning message to the oc tool when deleting objects. This RFE is being tracked in Red Hat Bug # 1378499). For more information or to also request this feature, please open a case with Red Hat Support.

On OpenShift 3.0 and 3.1, the projects default and openshift are recoverable, but openshift-infra is not. To recover default or openshift:

  1. Restart the master service:

    # systemctl restart atomic-openshift-master
    

    The master creates the missing namespaces and bindings on startup.

  2. Verify the namespaces exist and are not in the Terminating state:

    # oc get namespace/default namespace/openshift namespace/openshift
    
  3. Manually recreate the content (including templates, image streams, the registry, the router, and so on) by following the steps in Deploying a Docker Registry, Deploying a Router, and Loading the Default Image Streams and Templates.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.