- Deploy and Configure Ops Manager Resources >
- Configure an Ops Manager Resource to use Remote Mode
Configure an Ops Manager Resource to use Remote Mode¶
On this page
In a default configuration, the MongoDB Agents and Backup Daemons access MongoDB installation archives over the Internet from MongoDB, Inc.
You can configure Ops Manager to run in Remote Mode with the Kubernetes Operator if the nodes in your Kubernetes cluster don’t have access to the Internet. The Backup Daemons and managed MongoDB resources download installation archives only from Ops Manager, which proxies download requests to an HTTP endpoint on a local web server or S3-compatible store deployed to your Kubernetes cluster.
This procedure covers deploying an Nginx HTTP server to your Kubernetes cluster to host the MongoDB installation archives.
Prerequisites and Considerations¶
Deploy an Ops Manager Resource. The following procedure shows you how to update your Ops Manager Kubernetes object to enable Remote Mode.
Procedure¶
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"
.
Create a ConfigMap for Nginx.¶
The ConfigMap in this tutorial configures Nginx to:
- Run an HTTP server named
localhost
listening on port80
on a node in your Kubernetes cluster, and - Route HTTP requests for specific resources to locations that serve the the MongoDB Server and MongoDB Database Tools installation archives.
Paste the following example Nginx ConfigMap into a text editor:
Save this file with a
.yaml
file extension.Create the Nginx ConfigMap by invoking the following
kubectl
command on the ConfigMap file you created:
Deploy Nginx to your Kubernetes cluster.¶
The Nginx resource configuration in this tutorial:
- Deploys one Nginx replica,
- Creates volume mounts to store MongoDB Server and MongoDB Database Tools installation archives, and
- Defines init containers that use
curl
commands to download the installation archives that Nginx serves to MongoDB Database resources you deploy in your Kubernetes cluster.
- Vanilla Kubernetes
- OpenShift
Paste the following example Nginx resource configuration into a text editor:
Modify the lines highlighted in the example to specify the MongoDB Server versions that you want to install.
For example, to replace MongoDB version
4.0.2
with a different database version, update the following block:Update this block to modify the MongoDB Database Tools version:
- To load multiple versions, append
curl
commands to the appropriate initContainer for each version you want Nginx to serve.
For example, to configure Nginx to serve MongoDB
5.0.12
and6.0.1
:
- To load multiple versions, append
Save this file with a
.yaml
file extension.Deploy Nginx by invoking the following
kubectl
command on the Nginx resource file you created:
Paste the following example Nginx resource configuration into a text editor:
Modify the lines highlighted in the example to specify the MongoDB Server versions that you want to install.
For example, to replace MongoDB version
4.0.2
with a different database version, update the following block:Update this block to modify the MongoDB Database Tools version:
To load multiple versions, append
curl
commands to the appropriate initContainer for each version you want Nginx to serve.For example, to configure Nginx to serve MongoDB
4.2.0
and4.4.0
:Save this file with a
.yaml
file extension.Deploy Nginx by invoking the following
oc
command on the Nginx resource file you created:
Create a Kubernetes service to make Nginx accessible from other pods in your cluster.¶
The service in this tutorial exposes Nginx to traffic from other nodes
in your Kubernetes cluster over port 80
. This allows the MongoDB
Database resource pods you deploy using the Kubernetes Operator to download
the installation archives from Nginx.
Run the following command to create a service your Nginx deployment:
Paste the following example service into a text editor:
Save this file with a
.yaml
file extension.Create the service by invoking the following
kubectl
command on the service file you created:
Copy and update the highlighted fields of this Ops Manager resource.¶
The highlighted section uses the following Ops Manager configuration settings:
automation.versions.source: remote
inspec.configuration
to enable Remote Mode.automation.versions.download.baseUrl
inspec.configuration
to provide the base URL of the HTTP resources that serve the MongoDB installation archives.Update this line to replace
<namespace>
with the namespace to which you deploy resources with the Kubernetes Operator.automation.versions.download.baseUrl.allowOnlyAvailableBuilds: "false"
inspec.configuration
to help ensure enterprise builds have no issues.
Save your Ops Manager config file.¶
Apply changes to your Ops Manager deployment.¶
Invoke the following kubectl
command on the filename of the
Ops Manager resource definition:
Track the status of your Ops Manager instance.¶
To check the status of your Ops Manager resource, invoke the following command:
See Troubleshoot the Kubernetes Operator for information about the resource deployment statuses.
After the Ops Manager resource completes the Pending
phase, the
command returns output similar to the following:
Copy the value of the status.opsManager.url
field, which states
the resource’s connection URL. You use this value when you create a
ConfigMap later in the procedure.
Deploy a MongoDB Database Resource.¶
- If you have not done so already, complete the following prerequisites:
- Deploy a MongoDB Database resource
in the same namespace to which you deployed Ops Manager.
Ensure that you:
- Match the
spec.opsManager.configMapRef.name
of the resource to themetadata.name
of your ConfigMap. - Match the
spec.credentials
of the resource to the name of the secret you created that contains an Ops Manager programmatic API key pair.
- Match the
MongoDB Agents running in MongoDB database resource containers that you create with the Kubernetes Operator download the installation archives from Ops Manager via Nginx instead of from the Internet.