Docs Menu
Docs Home
/
MongoDB Enterprise Kubernetes Operator
/

Install the MongoDB Enterprise Kubernetes Operator

On this page

  • Prerequisites and Considerations
  • Install with Kubernetes
  • Install with OpenShift
  • Verify the Installation
  • Install a Specific Daily Build with Helm
  • Next Steps

Before you install the Kubernetes Operator, make sure you plan for your installation:

Note

This tutorial presumes some knowledge of Kubernetes and links to relevant Kubernetes documentation. If you are unfamiliar with Kubernetes, please review that documentation first.

Choose one of the following installation procedures to install the Kubernetes Operator:

The installation procedure varies based on how you want to configure your environment:

Note

Use the same namespace throughout

The following examples assume that you created a namespace using the default Kubernetes Operator namespace of mongodb. If you specified a different label for your namespace when you created it, change all values for metadata.namespace to that namespace.

To change the label for the namespace for the following deployment to production, edit all values for metadata.namespace in mongodb-enterprise.yaml:

##---
# Source: mongodb-enterprise-operator/templates/serviceaccount.yaml
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: mongodb-enterprise-operator
namespace: production
##---
# Source: mongodb-enterprise-operator/templates/operator.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb-enterprise-operator
namespace: production
---
# Example truncated
---
...
1

Invoke the following git command:

git clone https://github.com/mongodb/mongodb-enterprise-kubernetes.git
2

For example, if you cloned the repository in your home directory, run:

cd ~/mongodb-enterprise-kubernetes
3

Invoke the following kubectl command:

kubectl apply -f crds.yaml
4

To learn about optional Kubernetes Operator installation settings, see Operator kubectl and oc Installation Settings.

5

Invoke the following kubectl command:

kubectl apply -f mongodb-enterprise.yaml

Use the MongoDB Helm Charts for Kubernetes.

You can install the Kubernetes Operator with Helm 3.

1
helm repo add mongodb https://mongodb.github.io/helm-charts
2

Install MongoDB Helm Charts for Kubernetes. The following command installs the CustomResourceDefinitions and the Kubernetes Operator in the current namespace named default. By default, the Kubernetes Operator uses the default namespace.

helm install enterprise-operator mongodb/enterprise-operator

The following command installs the Kubernetes Operator in the mongodb namespace with the optional --create-namespace option.

helm install enterprise-operator mongodb/enterprise-operator \
--namespace mongodb \
--create-namespace

To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.

Use the MongoDB Helm Charts for Kubernetes.

You can install the Kubernetes Operator with Helm 3.

To install the Kubernetes Operator on a host not connected to the Internet:

1
docker pull quay.io/mongodb/mongodb-enterprise-operator-ubi:1.20.0; \
docker pull quay.io/mongodb/mongodb-enterprise-database-ubi:1.20.0; \
docker pull quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:<om-version>; \
docker pull quay.io/mongodb/mongodb-enterprise-init-ops-manager-ubi:1.20.0; \
docker pull quay.io/mongodb/mongodb-enterprise-init-appdb-ubi:1.20.0; \
docker pull quay.io/mongodb/mongodb-enterprise-init-database-ubi:1.20.0;

Replace the following values:

  • <op-version> with the Kubernetes Operator version you're installing

  • <om-version> with the Ops Manager version you're installing.

  • <db-version> with the version of the MongoDB Enterprise Database image that you want to use.

Tip

See also:

2
docker save quay.io/mongodb/mongodb-enterprise-operator-ubi:1.20.0 -o mongodb-enterprise-operator.tar; \
docker save quay.io/mongodb/mongodb-enterprise-database-ubi:1.20.0 -o mongodb-enterprise-database.tar; \
docker save quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:<om-version> -o mongodb-enterprise-ops-manager.tar; \
docker save quay.io/mongodb/mongodb-enterprise-init-ops-manager-ubi:1.20.0 -o mongodb-enterprise-init-ops-manager.tar; \
docker save quay.io/mongodb/mongodb-enterprise-init-appdb-ubi:1.20.0 -o mongodb-enterprise-init-appdb.tar;
docker save quay.io/mongodb/mongodb-enterprise-init-database-ubi:1.20.0 -o mongodb-enterprise-init-database.tar;

Replace the following values:

  • <op-version> with the Kubernetes Operator version you're installing

  • <om-version> with the Ops Manager version you're installing.

  • <db-version> with the version of the MongoDB Enterprise Database image that you want to use.

Tip

See also:

3
4
docker load -i mongodb-enterprise-operator.tar; \
docker load -i mongodb-enterprise-database.tar; \
docker load -i mongodb-enterprise-ops-manager.tar; \
docker load -i mongodb-enterprise-appdb.tar; \
docker load -i mongodb-enterprise-init-ops-manager.tar; \
docker load -i mongodb-enterprise-init-appdb.tar; \
docker load -i mongodb-enterprise-init-database.tar;

Replace the following values:

  • <op-version> with the Kubernetes Operator version you're installing

  • <om-version> with the Ops Manager version you're installing.

  • <db-version> with the version of the MongoDB Enterprise Database image that you want to use.

Tip

See also:

5
helm repo add mongodb https://mongodb.github.io/helm-charts
6

Install MongoDB Helm Charts for Kubernetes and set the value of registry.pullPolicy to IfNotPresent. To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.

helm install enterprise-operator mongodb/enterprise-operator \
--set registry.pullPolicy='IfNotPresent'

Before you begin, ensure that the MANAGED_SECURITY_CONTEXT flag is set to true when you deploy the Kubernetes Operator to OpenShift. This value is pre-defined in the values-openshift.yaml file.

The installation procedure varies based on how you want to configure your environment:

Note

Use the same namespace throughout

The following examples assume that you created a namespace using the default Kubernetes Operator namespace of mongodb. If you specified a different label for your namespace when you created it, change all values for metadata.namespace to that namespace.

To change the label for the namespace for the following deployment to production, edit all values for metadata.namespace in mongodb-enterprise-openshift.yaml:

##---
# Source: mongodb-enterprise-operator/templates/serviceaccount.yaml
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: enterprise-operator
namespace: production
##---
# Source: mongodb-enterprise-operator/templates/operator.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: enterprise-operator
namespace: production
---
# Example truncated
---
...
1

Invoke the following git command:

git clone https://github.com/mongodb/mongodb-enterprise-kubernetes.git
2

For example, if you cloned the repository in your home directory, run:

cd ~/mongodb-enterprise-kubernetes
3

Invoke the following oc command:

oc apply -f crds.yaml
4

To learn about optional Kubernetes Operator installation settings, see Operator kubectl and oc Installation Settings.

5
---
# Source: mongodb-enterprise-operator/templates/serviceaccount.yaml
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: enterprise-operator
namespace: mongodb
imagePullSecrets:
- name: <openshift-pull-secret>
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: mongodb-enterprise-appdb
namespace: mongodb
imagePullSecrets:
- name: <openshift-pull-secret>
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: mongodb-enterprise-database-pods
namespace: mongodb
imagePullSecrets:
- name: <openshift-pull-secret>

To learn more, see the registry.imagePullSecrets setting in the Helm installation settings.

6

Invoke the following oc command:

oc apply -f mongodb-enterprise-openshift.yaml

Use the MongoDB Helm Charts for Kubernetes.

You can install the Kubernetes Operator with Helm 3.

1
helm repo add mongodb https://mongodb.github.io/helm-charts
2

Install MongoDB Helm Charts for Kubernetes:

helm install enterprise-operator mongodb/enterprise-operator \
--values https://raw.githubusercontent.com/mongodb/helm-charts/main/charts/enterprise-operator/values-openshift.yaml

Use the values-openshift.yaml settings. To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.

Use the MongoDB Helm Charts for Kubernetes.

You can install the Kubernetes Operator with Helm 3.

To install the Kubernetes Operator on a host not connected to the Internet:

1
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-operator:1.20.0; \
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-database:1.20.0; \
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-ops-manager:<om-version>; \
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-appdb:10.2.15.5958-1_4.2.11-ent; \
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-init-ops-manager:1.20.0; \
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-init-appdb:1.20.0; \
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-init-database:1.20.0;

Replace the following values:

  • <op-version> with the Kubernetes Operator version you're installing

  • <om-version> with the Ops Manager version you're installing.

  • <db-version> with the version of the MongoDB Enterprise Database image that you want to use.

Tip

See also:

2
docker save quay.io/mongodb/mongodb-enterprise-operator-ubi:1.20.0 -o mongodb-enterprise-operator.tar; \
docker save quay.io/mongodb/mongodb-enterprise-database-ubi:1.20.0 -o mongodb-enterprise-database.tar; \
docker save quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:<om-version> -o mongodb-enterprise-ops-manager.tar; \
docker save quay.io/mongodb/mongodb-enterprise-init-ops-manager-ubi:1.20.0 -o mongodb-enterprise-init-ops-manager.tar; \
docker save quay.io/mongodb/mongodb-enterprise-init-appdb-ubi:1.20.0 -o mongodb-enterprise-init-appdb.tar;
docker save quay.io/mongodb/mongodb-enterprise-init-database-ubi:1.20.0 -o mongodb-enterprise-init-database.tar;

Replace the following values:

  • <op-version> with the Kubernetes Operator version you're installing

  • <om-version> with the Ops Manager version you're installing.

  • <db-version> with the version of the MongoDB Enterprise Database image that you want to use.

Tip

See also:

3
4
docker load -i mongodb-enterprise-operator.tar; \
docker load -i mongodb-enterprise-database.tar; \
docker load -i mongodb-enterprise-ops-manager.tar; \
docker load -i mongodb-enterprise-appdb.tar; \
docker load -i mongodb-enterprise-init-ops-manager.tar; \
docker load -i mongodb-enterprise-init-appdb.tar; \
docker load -i mongodb-enterprise-init-database.tar;

Replace the following values:

  • <op-version> with the Kubernetes Operator version you're installing

  • <om-version> with the Ops Manager version you're installing.

  • <db-version> with the version of the MongoDB Enterprise Database image that you want to use.

Tip

See also:

5
helm repo add mongodb https://mongodb.github.io/helm-charts
6

Install MongoDB Helm Charts for Kubernetes:

helm install enterprise-operator mongodb/enterprise-operator \
--set registry.pullPolicy='IfNotPresent' \
--set registry.imagePullSecrets='<openshift-pull-secret>' \
--values https://raw.githubusercontent.com/mongodb/helm-charts/main/charts/enterprise-operator/values-openshift.yaml

Use the values-openshift.yaml settings, registry.pullPolicy=IfNotPresent, and registry.imagePullSecrets=<openshift-pull-secret>. To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.

To verify that the Kubernetes Operator installed correctly, run the following command and verify the output:

kubectl describe deployments mongodb-enterprise-operator -n <metadata.namespace>
oc describe deployments mongodb-enterprise-operator -n <metadata.namespace>

By default, deployments exist in the mongodb namespace. If the following error message appears, ensure you use the correct namespace:

Error from server (NotFound): deployments.apps "mongodb-enterprise-operator" not found

To troubleshoot your Kubernetes Operator, see Review Logs from the Kubernetes Operator and other troubleshooting topics.

Important

If you need to remove the Kubernetes Operator or the namespace, you first must remove MongoDB resources.

MongoDB rebuilds Kubernetes Operator images every day to integrate the latest security and OS updates.

By default, helm installs the latest build for the version of the Kubernetes Operator you specify.

To install an earlier build, specify the build ID as a parameter with --set build=<build-id>. Build IDs are always in the format -b<YYYYMMDD>T000000Z, where <YYYYMMDD> is the date that the build you want to use was created.

Example

This example shows how to install the Kubernetes Operator with the latest image:

helm install enterprise-operator mongodb/enterprise-operator

This example shows how to install the Kubernetes Operator with the image created at midnight on February 5th, 2021:

helm install enterprise-operator mongodb/enterprise-operator \
--set build=-b20210205T000000Z

Note

MongoDB recommends using the default (latest) build.

After installing the MongoDB Enterprise Kubernetes Operator, you can: