Create a Project using a ConfigMap

The MongoDB Enterprise Kubernetes Operator uses a Kubernetes ConfigMap to create or link your Ops Manager Project. To create a Kubernetes Operator ConfigMap, you need to edit a few lines of the example ConfigMap YAML file and apply the ConfigMap.



  • Kubernetes version 1.11 or later or Openshift version 3.11 or later.
  • MongoDB Enterprise Kubernetes Operator version 0.11 or later installed.



Configure kubectl to default to your namespace.

If you have not already, run the following command to execute all kubectl commands in the namespace you created:

kubectl config set-context $(kubectl config current-context) --namespace=<namespace>

Copy the following example ConfigMap.

apiVersion: v1
kind: ConfigMap
  name: <myconfigmap>
  projectName: <myOpsManagerProjectName> # Optional
  orgId: <orgId> # Optional
  baseUrl: https://<myOpsManagerURL>

Open your preferred text editor and paste the example ConfigMap into a new text file.


Update the values in the lines highlighted in the example ConfigMap.

Key Type Description Example string

Label for a Kubernetes object.

See also

  • Kubernetes documentation on names. This name must follow RFC1123 naming conventions, using only lowercase alphanumeric characters, ‘-‘ or ‘.’, and must start and end with an alphanumeric character.
data.projectName string

Label for your Ops Manager Project.

Let Kubernetes Operator create the Project

The Kubernetes Operator creates the Ops Manager Project if it does not exist. It is strongly recommended to use the Operator to create a new Project for Kubernetes to manage. The Operator adds additional internal information to Projects that it creates.

If you omit the projectName, the Kubernetes Operator creates a project with the same name as your Kubernetes resource.

If you need or want to use an existing Project, you can find the projectName by clicking the All Clusters link at the top left of the screen, then either search by name in the Search box or scroll to find the name in the list. Each card in this list represents the combination of one Organization and Project.

data.orgId string

24 character hex string that uniquely identifies your MongoDB Organization. You can find the orgId in your Ops Manager URL:

  1. Click the Context menu.

  2. Select your Organization.

  3. View the current URL in your browser and copy the value displayed in the <orgId> placeholder below:


This field is optional. If you omit the orgId, Ops Manager creates an Organization called projectName that contains a Project also called projectName.

You must have the Organization Project Creator role to create a new project within an existing organization.

Limited to Cloud Manager or Ops Manager Organizations

If you set this value, it can be for a Cloud Manager or Ops Manager organization only. If you try to use an Atlas organization, the Kubernetes Operator may not work as intended.

data.baseUrl string

URL to your Ops Manager Application including the FQDN and port number.


You may use Cloud Manager for the data.baseUrl value.

Save this file with a .yaml file extension.


Invoke the Kubernetes command to create your ConfigMap.

kubectl apply -f <myconfigmap.yaml>


All subsequent kubectl commands you invoke must add the -n option with the metadata.namespace you specified in your ConfigMap.


Invoke the Kubernetes command to verify your ConfigMap.

kubectl describe configmaps <myconfigmap> -n <metadata.namespace>

Always include the namespace option with kubectl

kubectl defaults to an empty namespace if you do not specify the -n option, resulting in deployment failures. You must specify the value of the <metadata.namespace> field. The Kubernetes Operator, secret, and MongoDB Kubernetes resources should run in the same unique namespace.

This command returns a ConfigMap description in the shell:

Name:           <myconfigmap>
Namespace:      <metadata.namespace>
Labels:         <none>
Annotations:    <none>


Starting in MongoDB Enterprise Kubernetes Operator version 1.3.0, you can only have one MongoDB resource per project. To learn how to deploy a MongoDB resource in your project, see Deploy a MongoDB Database Resource.

Next Steps

Now that you created your ConfigMap, Create Credentials for the Kubernetes Operator before you start deploying MongoDB resources.