Navigation

Upgrade the MongoDB Enterprise Kubernetes Operator

The following procedure outlines how to upgrade the Kubernetes Operator to its latest version.

Upgrade using Kubernetes

The following steps depend on how your environment is configured:

1

Upgrade the CustomResourceDefinitions for MongoDB deployments.

Invoke the following kubectl command:

kubectl replace -f crds.yaml
2

Optional: Customize the Kubernetes Operator YAML before upgrading it.

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

3

If you are upgrading the Operator to version 1.13.0 or later, specify the spec.opsManager.configMapRef.name or the spec.cloudManager.configMapRef.name settings:

  1. Open the MongoDB Database Resource Specification in the editor of your choice.
  2. Add the value to the spec.opsManager.configMapRef.name setting or the spec.cloudManager.configMapRef.name setting and save the specification.

To learn more, see Changes to the MongoDB Resource.

4

Upgrade to the new version of the Kubernetes Operator.

Invoke the following kubectl command:

kubectl apply -f mongodb-enterprise.yaml
1

If you are upgrading the Operator to version 1.13.0 or later, specify the spec.opsManager.configMapRef.name or the spec.cloudManager.configMapRef.name settings:

  1. Open the MongoDB Database Resource Specification in the editor of your choice.
  2. Add the value to the spec.opsManager.configMapRef.name setting or the spec.cloudManager.configMapRef.name setting and save the specification.

To learn more, see Changes to the MongoDB Resource.

2

Optional: Customize your Helm Chart before upgrading it.

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

3

Upgrade the Kubernetes Operator.

Invoke the following helm command:

helm upgrade enterprise-operator mongodb/enterprise-operator

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

1

If you are upgrading the Operator to version 1.13.0 or later, specify the spec.opsManager.configMapRef.name or the spec.cloudManager.configMapRef.name settings:

  1. Open the MongoDB Database Resource Specification in the editor of your choice.
  2. Add the value to the spec.opsManager.configMapRef.name setting or the spec.cloudManager.configMapRef.name setting and save the specification.

To learn more, see Changes to the MongoDB Resource.

2

Optional: Customize your Helm Chart before upgrading it.

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

3

Upgrade to the latest version of the Kubernetes Operator.

Invoke the following helm upgrade command. Use the registry.pullPolicy=IfNotPresent setting. To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.

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

Upgrade using OpenShift

The following steps depend on how your environment is configured:

1

Upgrade the CustomResourceDefinitions for MongoDB deployments.

Invoke the following oc command:

oc replace -f crds.yaml
2

Optional: Customize the Kubernetes Operator YAML before upgrading it.

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

3

If you are upgrading the Operator to version 1.13.0 or later, specify the spec.opsManager.configMapRef.name or the spec.cloudManager.configMapRef.name settings:

  1. Open the MongoDB Database Resource Specification in the editor of your choice.
  2. Add the value to the spec.opsManager.configMapRef.name setting or the spec.cloudManager.configMapRef.name setting and save the specification.

To learn more, see Changes to the MongoDB Resource.

4

Upgrade to the new version of the Kubernetes Operator.

Invoke the following oc command:

oc apply -f mongodb-enterprise-openshift.yaml
1

If you are upgrading the Operator to version 1.13.0 or later, specify the spec.opsManager.configMapRef.name or the spec.cloudManager.configMapRef.name settings:

  1. Open the MongoDB Database Resource Specification in the editor of your choice.
  2. Add the value to the spec.opsManager.configMapRef.name setting or the spec.cloudManager.configMapRef.name setting and save the specification.

To learn more, see Changes to the MongoDB Resource.

2

Optional: Customize your Helm Chart before upgrading it.

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

3

Upgrade the Kubernetes Operator.

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

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

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

1

If you are upgrading the Operator to version 1.13.0 or later, specify the spec.opsManager.configMapRef.name or the spec.cloudManager.configMapRef.name settings:

  1. Open the MongoDB Database Resource Specification in the editor of your choice.
  2. Add the value to the spec.opsManager.configMapRef.name setting or the spec.cloudManager.configMapRef.name setting and save the specification.

To learn more, see Changes to the MongoDB Resource.

2

Optional: Customize your Helm Chart before upgrading it.

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

3

Upgrade to the latest version of the Kubernetes Operator.

Invoke the following helm upgrade command:

helm upgrade 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 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.