Quick Start¶
On this page
Important
This section is for single Kubernetes cluster deployments only. For multi-Kubernetes-cluster deployments, see Multi-Kubernetes-Cluster Quick Start.
MongoDB Enterprise Kubernetes Operator uses the Kubernetes API and tools to manage MongoDB clusters. Kubernetes Operator works together with MongoDB Cloud Manager or Ops Manager. This tutorial demonstrates how to deploy and connect to your first replica set in MongoDB Cloud Manager with Kubernetes Operator. You can use Kind to quickly set up a cluster. To learn more, see Kind.
Prerequisites¶
This tutorial requires:
- A running MongoDB Cloud Manager cluster.
- A running Kubernetes cluster.
- Kubernetes nodes running on supported hardware architectures.
Procedure¶
Add the MongoDB Helm Charts for Kubernetes repository to Helm.¶
Install the MongoDB Enterprise Kubernetes Operator¶
To install the Kubernetes Operator with the Helm Chart, see the instructions in the repository.
Example
The following command installs the MongoDB Enterprise Kubernetes Operator in the mongodb
namespace with the optional --create-namespace
option. By
default, Kubernetes Operator uses the default
namespace.
Configure kubectl
to default to your namespace.¶
If you haven’t already, run the following command to execute all
kubectl
commands in the namespace you created:
Configure the Kubernetes Operator¶
- Go to the Kubernetes Setup Page in the Cloud Manager UI.
- Click Create New API Keys or Use Existing API Keys.
- Complete the form. To learn more, see Programmatic Access to Cloud Manager.
- Click Generate Key and YAML.
Copy and save the ConfigMap.¶
Copy and save the generated config-map.yaml
file.
Example:
To learn more, see the parameter descriptions.
Copy and save the Secret.¶
Copy and save the generated secret.yaml
file.
Example:
For security purposes, MongoDB Cloud Manager displays this file only once.
Apply the ConfigMap and Secret.¶
Run the following command:
Deploy the replica set resource.¶
Copy and save the following YAML file:
Run the following command:
Create a secret with your database user password¶
You can choose to use a cleartext password or a Base64-encoded
password. Plaintext passwords use stringData.password
and
Base64-encoded passwords use data.password
.
Note
Provide your values for the following parameters. To learn more, see the parameter descriptions.
For a cleartext password, create and save the following YAML file:
For a Base64-encoded password, create and save the following YAML file:
Create a database user.¶
Copy and save the following MongoDB User Resource Specification file:
Run the following command:
Optional: View the newly created user in Cloud Manager or Ops Manager.¶
You can view the newly-created user in Cloud Manager or Ops Manager:
- From the Project’s Deployment view, click the Security tab.
- Click the MongoDB Users nested tab.
Connect to the replica set.¶
Perform the following steps in the Cloud Manager application:
- Click Deployment in the left navigation.
- Click for the deployment to which you want to connect.
- Click Connect to this instance.
- Run the connection command in a terminal to connect to the deployment.