Navigation

Prerequisites

On this page

Procedure

To install the MongoDB Kubernetes Operator, you must:

1

Have a Kubernetes solution available to use, and verify hardware architecture support.

If you need a Kubernetes solution, see the Kubernetes documentation on picking the right solution. Review supported hardware architectures.

2

Clone the MongoDB Enterprise Kubernetes Operator repository.

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

Note

You can use Helm to install the Kubernetes Operator. To learn how to install Helm, see its documentation on GitHub.

3

Create a namespace for your Kubernetes deployment.

By default, The Kubernetes Operator uses the mongodb namespace. To simplify your installation, consider creating a namespace labeled mongodb using the following kubectl command:

kubectl create namespace mongodb

If you do not want to use the mongodb namespace, you can label your namespace anything you like:

kubectl create namespace <namespaceName>
4
5

Required for OpenShift Installs: Create a secret that contains credentials authorized to pull images from the registry.connect.redhat.com repository.

If you use the Kubernetes Operator to deploy MongoDB resources to multiple namespaces or with a cluster-wide scope, create the secret only in the namespace where you intend to deploy the Kubernetes Operator. The Kubernetes Operator synchronizes the secret across all watched namespaces.

  1. If you have not already, obtain a Red Hat subscription.

  2. Create a Registry Service Account.

  3. Click on your Registry Service Account, then click the Docker Configuration tab.

  4. Download the <account-name>-auth.json file and open it in a text editor.

  5. Copy the registry.redhat.io object, and paste another instance of this object into the file. Remember to add a comma after the first object. Rename the second object registry.connect.redhat.com, then save the file:

    {
      "auths": {
        "registry.redhat.io": {
          "auth": "<encoded-string>"
        },
        "registry.connect.redhat.com": {
          "auth": "<encoded-string>"
        }
      }
    }
    
  6. Create an openshift-pull-secret.yaml file and add the contents of the modified <account-name>-auth.json file as stringData named .dockerconfigjson to the openshift-pull-secret.yaml secret file.

    apiVersion: v1
    kind: Secret
    metadata:
      name: openshift-pull-secret
    stringData:
      .dockerconfigjson: |
          {
            "auths": {
              "registry.redhat.io": {
                "auth": "<encoded-string>"
              },
              "registry.connect.redhat.com": {
                "auth": "<encoded-string>"
              }
            }
          }
    type: kubernetes.io/dockerconfigjson
    

    The value you provide in the metadata.name field contains the secret name. Provide this value when asked for the <openshift-pull-secret>.

  7. Create a secret from the openshift-pull-secret.yaml file in the same namespace in which you will deploy the Kubernetes Operator.

    oc apply -f openshift-pull-secret.yaml -n <metadata.namespace>