Navigation
You were redirected from a different version of the documentation. Click here to go back.

Configure Kubernetes for Deploying MongoDB Resource

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:

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:

1

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.
2

Enter the IP addresses to add to your Cloud Manager project’s IP access list to grant programmatic access from your Kubernetes environment.

3

Generate ConfigMap and Kubernetes secret YAML files.

To generate the ConfigMap and Kubernetes secret YAML files:

  • Click Generate Key and YAML if you are generating new API keys.
  • Click Generate YAML if you are using existing API keys.
4

Follow the steps in the Generated ConfigMap and Secret YAML file modal to apply the generated ConfigMap and Kubernetes secret YAML files to your Kubernetes environment.