Configure Kubernetes for Deploying MongoDB Resource
On this page
- OAuth 2.0 authentication for programmatic access to Cloud Manager is available as a Preview feature.
- The feature and the corresponding documentation might change at any time during the Preview period. To use OAuth 2.0 authentication, create a service account to use in your requests to the Cloud Manager Public API.
You can use the Kubernetes Operator to deploy MongoDB resources such as a replica set, a sharded cluster, or a standalone instance using an object. Cloud Manager can generate the YAML files you need to configure your Kubernetes environment for deploying a MongoDB Database resource.
To generate the YAML files:
Verify Permissions
You must have one of the following roles to access the Cloud Manager UI for setting up Kubernetes:
Navigate to the Kubernetes Setup Page in the Cloud Manager UI
To access the Kubernetes Setup page in the Cloud Manager UI:
If you are a Global Owner
or Organization Owner
, you can access the Kubernetes Setup page in the Cloud Manager UI
by doing the following also:
In MongoDB Cloud Manager, go to the Organization Settings page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
Click the Organization Settings icon next to the Organizations menu.
The Organization Settings page displays.
Go to the Kubernetes Setup page for your organization.
Click Kubernetes Setup in the sidebar.
The Kubernetes Setup page displays.
Set Up Kubernetes for a MongoDB Resource
The MongoDB Enterprise Kubernetes Operator requires a Kubernetes ConfigMap to create or link your Cloud Manager project.
You can use the Cloud Manager Kubernetes Setup page to automatically generate the ConfigMap. The generated YAML file for the ConfigMap looks similar to the following:
apiVersion: v1 kind: ConfigMap metadata: name: my-project namespace: mongodb data: baseUrl: https://cloud.mongodb.com # Optional Parameters # projectName: <your-project-name> orgId: <your-org-id>
You need to store your Programmatic API Key as a Kubernetes secret to create or update Kubernetes objects in your Cloud Manager project. A Kubernetes secret stores authentication credentials so only Kubernetes can access them.
You can specify your existing API keys or generate new API keys to create the Kubernetes secret in the Cloud Manager Kubernetes Setup page. The generated YAML file for the secret looks similar to the following:
apiVersion: v1 kind: Secret metadata: name: organization-secret namespace: mongodb stringData: user: <private-key> publicApiKey: <public-api-key>
Generating the YAML Files
To setup Kubernetes for a MongoDB resource:
Specify the API keys for accessing your Cloud Manager project.
Click Create New API Keys to generate new API keys.
Click Use Existing API Keys to specify your existing public and private keys.