Docs Menu
Docs Home
/
MongoDB Enterprise Kubernetes Operator
/ /

Upgrade the MongoDB Enterprise Kubernetes Operator

On this page

  • Upgrade the MongoDB Enterprise Kubernetes Operator Running in Kubernetes
  • Upgrade the MongoDB Enterprise Kubernetes Operator Running in OpenShift
  • Verify the Installation
  • Next Steps

The following procedure outlines how to upgrade the Kubernetes Operator to its latest version. This upgrade process parallels the Kubernetes Operator installation process.

Note

Use the same namespace throughout

By default, the Kubernetes Operator deploys all resources in your Kubernetes cluster to the namespace mongodb. You can deploy Kubernetes Operator resources to a different namespace by editing 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

To avoid breaking changes, you should ensure that you select the same settings as those in your existing deployment. To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.

2

Populate the <version> placeholder and run the following kubectl command to deploy your chosen version of the Kubernetes Operator to your Kubernetes cluster:

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-enterprise-kubernetes/<version>/mongodb-enterprise.yaml
3

Populate the <version> placeholder and run the following kubectl command to deploy your chosen version of the CRDs to your Kubernetes cluster:

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-enterprise-kubernetes/<version>/crds.yaml

Use the MongoDB Helm Charts for Kubernetes.

1

Run the following command to check the version of your current Helm template:

helm search repo mongodb/enterprise-operator

If your currently installed version is not the latest release, run the following commmand to update your Helm repo:

helm repo update mongodb

If you don't have the Helm repo installed locally, you can install it by running:

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

To avoid breaking changes, you should ensure that you select the same settings as those in your existing deployment. To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.

3

Populate the <version> placeholder and run the following kubectl command to deploy the CRDs to your Kubernetes cluster:

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-enterprise-kubernetes/<version>/crds.yaml
4

Run the following helm command to deploy the Kubernetes Operator to the default namespace in your Kubernetes cluster:

helm install enterprise-operator mongodb/enterprise-operator

You can pass the --namespace and --namespace-create flags to deploy the Kubernetes Operator to a non-default namespace, like so:

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

The following steps depend on how your environment is configured:

Note

Use the same namespace throughout

By default, the Kubernetes Operator deploys all resources in your Kubernetes cluster to the namespace mongodb. You can deploy Kubernetes Operator resources to a different namespace by editing 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

To avoid breaking changes, you should ensure that you select the same settings as those in your existing deployment. To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.

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

Populate the <version> placeholder and run the following oc:

oc apply -f https://raw.githubusercontent.com/mongodb/mongodb-enterprise-kubernetes/<version>/mongodb-enterprise-openshift.yaml
3

Run the following oc command:

Populate the <version> placeholder and run the following oc command to deploy your chosen version of the CRDs to your Kubernetes cluster:

oc apply -f https://raw.githubusercontent.com/mongodb/mongodb-enterprise-kubernetes/<version>/crds.yaml
1

Run the following command to check the version of your current Helm template:

helm search repo mongodb/enterprise-operator

If your currently installed version is not the latest release, run the following commmand to update your Helm repo:

helm repo update mongodb

If you don't have the Helm repo installed locally, you can install it by running:

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

To avoid breaking changes, you should ensure that you select the same settings as those in your existing deployment. To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.

3

Populate the <version> placeholder and run the following kubectl command to deploy the CRDs to your Kubernetes cluster:

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-enterprise-kubernetes/<version>/crds.yaml
4

Run the following helm command to deploy the Kubernetes Operator to the default namespace in your Kubernetes cluster:

helm install enterprise-operator mongodb/enterprise-operator

You can pass the --namespace and --namespace-create flags to deploy the Kubernetes Operator to a non-default namespace, like so:

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

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.

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.

After upgrading the MongoDB Enterprise Kubernetes Operator, you can: