Navigation
This version of the documentation is archived and no longer supported.

Install the MongoDB Enterprise Kubernetes Operator

Prerequisites and Considerations

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

Note

This tutorial presumes some knowledge of Kubernetes, but does link to relevant Kubernetes documentation where possible. If you are unfamiliar with Kubernetes, please review that documentation first.

Procedure

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

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

Change to the directory in which you cloned the repository.

2

Install the CustomResourceDefinitions for MongoDB deployments using the following kubectl command:

Invoke the following kubectl command:

kubectl apply -f crds.yaml
3

Optional: Customize the Kubernetes Operator YAML before installing it.

  1. You might need to add one or more optional settings.

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

4

Install the Kubernetes Operator using the following kubectl command:

Invoke the following kubectl command:

kubectl apply -f mongodb-enterprise.yaml

You can install the Kubernetes Operator with Helm 3.

1

Change to the directory in which you cloned the repository.

2

Install the Kubernetes Operator using the following helm command:

Invoke the following helm command:

helm install <chart-name> helm_chart \
     --values helm_chart/values.yaml

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

You can install the Kubernetes Operator with Helm 3.

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

1

Use docker to request the files on a host connected to the Internet.

docker pull quay.io/mongodb/mongodb-enterprise-operator:<op-version>; \
docker pull quay.io/mongodb/mongodb-enterprise-database:<db-version>; \
docker pull quay.io/mongodb/mongodb-enterprise-ops-manager:<om-version>; \
docker pull quay.io/mongodb/mongodb-enterprise-appdb:10.2.15.5958-1_4.2.11-ent; \
docker pull quay.io/mongodb/mongodb-enterprise-init-ops-manager:1.0.3; \
docker pull quay.io/mongodb/mongodb-enterprise-init-appdb:1.0.6; \
docker pull quay.io/mongodb/mongodb-enterprise-init-database:1.0.2;

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.

See also

database.version

2

Export the Kubernetes Operator images as .tar archive files:

docker save quay.io/mongodb/mongodb-enterprise-operator:<op-version> -o mongodb-enterprise-operator.tar; \
docker save quay.io/mongodb/mongodb-enterprise-database:<db-version> -o mongodb-enterprise-database.tar; \
docker save quay.io/mongodb/mongodb-enterprise-ops-manager:<om-version> -o mongodb-enterprise-ops-manager.tar; \
docker save quay.io/mongodb/mongodb-enterprise-appdb:10.2.15.5958-1_4.2.11-ent -o mongodb-enterprise-appdb.tar; \
docker save quay.io/mongodb/mongodb-enterprise-init-ops-manager:1.0.3 -o mongodb-enterprise-init-ops-manager.tar; \
docker save quay.io/mongodb/mongodb-enterprise-init-appdb:1.0.6 -o mongodb-enterprise-init-appdb.tar;
docker save quay.io/mongodb/mongodb-enterprise-init-database:1.0.2 -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.

See also

database.version

3

Copy these .tar files to the host running the Kubernetes docker daemon.

4

Import the .tar files into docker.

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.

See also

database.version

5

Install the Kubernetes Operator with modified pull policy values using the following helm command:

Invoke the following helm command:

helm install <chart-name> helm_chart \
     --values helm_chart/values.yaml \
     --set registry.pullPolicy=IfNotPresent

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

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

Change to the directory in which you cloned the repository.

2

Install the CustomResourceDefinitions for MongoDB deployments.

OpenShift 3.11 or earlier

If you run OpenShift 3.11 or earlier, you must first manually edit the CustomResourceDefinitions to remove subresources. In each CustomResourceDefinition, remove the following option:

spec:
  subresources:
    status: {}

Invoke the following oc command:

oc apply -f crds.yaml
3

Optional: Customize the Kubernetes Operator YAML before installing it.

  1. You must add your <openshift-pull-secret> to the ServiceAccount definitions:

    ---
    # 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>
    
  2. You might need to add one or more optional settings.

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

4

Install the Kubernetes Operator using the following oc command:

Invoke the following oc command:

oc apply -f mongodb-enterprise-openshift.yaml

You can install the Kubernetes Operator with Helm 3.

1

Change to the directory in which you cloned the repository.

2

Add your OpenShift Pull Secret to the OpenShift Values file.

Add the name of your <openshift-pull-secret> to the registry.imagePullSecrets setting in the helm_chart/values-openshift.yaml file:

registry:
# The pull secret must be specified
  imagePullSecrets: <openshift-pull-secret>
3

Install the Kubernetes Operator using helm.

OpenShift 3.11 or earlier

If you run OpenShift 3.11 or earlier, you must first manually edit the CustomResourceDefinitions to remove subresources. In each CustomResourceDefinition, remove the following option:

spec:
  subresources:
    status: {}

Invoke the following helm command:

helm install <chart-name> helm_chart \
     --values helm_chart/values-openshift.yaml

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

You can install the Kubernetes Operator with Helm 3.

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

1

Use docker to request the files on a host connected to the Internet.

docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-operator:<op-version>; \
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-database:<db-version>; \
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.0.3; \
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-init-appdb:1.0.6; \
docker pull registry.connect.redhat.com/mongodb/mongodb-enterprise-init-database:1.0.2;

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.

See also

database.version

2

Export the Kubernetes Operator images as .tar archive files:

docker save registry.connect.redhat.com/mongodb/mongodb-enterprise-operator:<op-version> -o mongodb-enterprise-operator.tar; \
docker save registry.connect.redhat.com/mongodb/mongodb-enterprise-database:<db-version> -o mongodb-enterprise-database.tar; \
docker save registry.connect.redhat.com/mongodb/mongodb-enterprise-ops-manager:<om-version> -o mongodb-enterprise-ops-manager.tar; \
docker save registry.connect.redhat.com/mongodb/mongodb-enterprise-appdb:10.2.15.5958-1_4.2.11-ent -o mongodb-enterprise-appdb.tar; \
docker save registry.connect.redhat.com/mongodb/mongodb-enterprise-init-ops-manager:1.0.3 -o mongodb-enterprise-init-ops-manager.tar; \
docker save registry.connect.redhat.com/mongodb/mongodb-enterprise-init-appdb:1.0.6 -o mongodb-enterprise-init-appdb.tar;
docker save registry.connect.redhat.com/mongodb/mongodb-enterprise-init-database:1.0.2 -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.

See also

database.version

3

Copy these .tar files to the host running the Kubernetes docker daemon.

4

Import the .tar files into docker.

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.

See also

database.version

5

Add your OpenShift Pull Secret to the OpenShift Values file.

Add the name of your <openshift-pull-secret> to the registry.imagePullSecrets setting in the helm_chart/values-openshift.yaml file:

registry:
# The pull secret must be specified
  imagePullSecrets: <openshift-pull-secret>
6

Install the Kubernetes Operator with modified pull policy values.

OpenShift 3.11 or earlier

If you run OpenShift 3.11 or earlier, you must first manually edit the CustomResourceDefinitions to remove subresources. In each CustomResourceDefinition, remove the following option:

spec:
  subresources:
    status: {}

Invoke the following helm command:

helm install <chart-name> helm_chart \
     --values helm_chart/values-openshift.yaml \
     --set registry.pullPolicy=IfNotPresent \
     --set registry.imagePullSecrets=<openshift-pull-secret>

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

Verify the Installation

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

kubectl describe deployments mongodb-enterprise-operator -n <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.

Important

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

Next Steps

After installing the MongoDB Enterprise Kubernetes Operator, you can: