- Deploy and Configure MongoDB Database Resources >
- Configure the Kubernetes Operator for MongoDB Database Resources >
- Create One Project using a ConfigMap
Create One Project using a ConfigMap¶
On this page
The MongoDB Enterprise Kubernetes Operator uses a Kubernetes ConfigMap to create or link your Ops Manager Project. To create a Kubernetes Operator ConfigMap, you can edit a few lines of the example ConfigMap YAML file and apply the ConfigMap. To view a full example, see the project.yaml file.
Alternatively, you can use the MongoDB Cloud Manager UI or the Ops Manager UI to automatically generate the ConfigMap YAML file, which you can then apply to your Kubernetes environment.
Considerations¶
You can only deploy one MongoDB resource per project. See Deploy a MongoDB Database Resource.
Important
- You can use the Kubernetes Operator to deploy MongoDB resources with Cloud Manager and with Ops Manager version 5.0.x or later.
- You can use the Atlas Operator to deploy MongoDB resources to Atlas.
Prerequisites¶
- Kubernetes version 1.11 or later or Openshift version 3.11 or later.
- MongoDB Enterprise Kubernetes Operator version 0.11 or later installed.
Create One Project Using a ConfigMap¶
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.
Note
If you are deploying an Ops Manager resource in a multi-Kubernetes-cluster deployment:
- Set the
context
to the name of the central cluster, such as:kubectl config set context "$MDB_CENTRAL_CLUSTER_FULL_NAME"
. - Set the
--namespace
to the same scope that you used for your multi-Kubernetes-cluster deployment, such as:kubectl config --namespace "mongodb"
.
Invoke the following command to create a ConfigMap.¶
Key | Type | Description | Example |
---|---|---|---|
metadata.name |
string | Name of the Kubernetes object. Resource names must be 44 characters or less. |
my-project |
metadata.namespace |
string | Kubernetes namespace where the Kubernetes Operator creates this
MongoDB resource and other objects. |
mongodb |
data.projectName |
string | Label for your Ops Manager Project. The Kubernetes Operator creates the Ops Manager project if it does
not exist. If you omit the To use an existing project in a Cloud Manager or Ops Manager
organization, locate
the |
myProjectName |
data.orgId |
string | Required. 24 character hex string that uniquely identifies your Cloud Manager or Ops Manager Organization. Important
Specify an existing Organization: 1 Find the organization’s ID.¶Click Settings in the left navigation bar. 2 Copy and paste the orgId into the URL.¶Select your organization, view the current URL
in your browser and copy the value displayed in
the
Note You must have the If you provide an empty string as your |
5b890e0feacf0b76ff3e7183 |
data.baseUrl |
string | URL to your Ops Manager Application including the FQDN and port number. Important If you deploy Ops Manager with the Kubernetes Operator and Ops Manager will
manage MongoDB database resources deployed outside of the Kubernetes
cluster it’s deployed to, you must set Note If you’re using Cloud Manager, set the |
https://ops.example.com:8443 |
Connect to HTTPS-enabled Ops Manager Using a Custom CA¶
You might have chosen to use your own TLS certificate to enable HTTPS for your Ops Manager instance. If you used a custom certificate, you need to add the CA that signed that custom certificate to the Kubernetes Operator. To add your custom CA, complete the following:
Create a ConfigMap for the certificate authority (CA) certificate.¶
The Kubernetes Operator requires the root CA certificate of the CA that issued the Ops Manager host’s certificate. Run the following command to create a ConfigMap containing the root CA in the same namespace of your database Pods:
Important
The Kubernetes Operator requires that you name the Ops Manager resource’s
certificate mms-ca.crt
in the ConfigMap.
Copy the highlighted section of the following example ConfigMap
.¶
Specify the TLS settings¶
Change the following TLS keys:
Key | Type | Description | Example |
---|---|---|---|
sslMMSCAConfigMap |
string | Name of the ConfigMap created in the first step containing the root CA certificate used to sign the Ops Manager host’s certificate. This mounts the CA certificate to the Kubernetes Operator and database resources. | my-root-ca |
sslRequireValidMMSServerCertificates |
boolean | Forces the Operator to require a valid TLS certificate from Ops Manager. Important The value must be enclosed in single quotes or the operator will throw an error. |
'true' |
Save your updated ConfigMap.¶
Invoke the Kubernetes command to verify your ConfigMap.¶
Important
Always include the namespace option with kubectl
.
kubectl
defaults to an empty namespace if you don’t specify the
-n
option, resulting in deployment failures. You must specify
the value of the <metadata.namespace>
field. The
Kubernetes Operator, secret, and MongoDB
resources should run in the
same unique namespace.
This command returns a ConfigMap description in the shell:
Next Steps¶
Now that you created your ConfigMap, Create Credentials for the Kubernetes Operator before you start deploying MongoDB resources.