Upgrade the MongoDB Enterprise Kubernetes Operator
On this page
The following procedure outlines how to upgrade the Kubernetes Operator to its latest version.
Note
In Kubernetes Operator 1.20, the container registry changed for the application database image and the images use a new tag suffix. When you upgrade the Kubernetes Operator, the Kubernetes Operator automatically updates the earlier suffix, -ent
, for all images that reference the new container registry to -ubi8
or the suffix set in MDB_IMAGE_TYPE or mongodb.imageType.
For example, the Kubernetes Operator changes quay.io/mongodb/mongodb-enterprise-server:4.4.5-ent
to quay.io/mongodb/mongodb-enterprise-server:4.4.5-ubi8
.
To stop the Kubernetes Operator from automatically updating the suffix, set MDB_APPDB_ASSUME_OLD_FORMAT or mongodb.appdbAssumeOldFormat to true
. For example, you might want to stop the automatic suffix change if you're mirroring this image from your own repository.
Warning
Starting from 1.17, the Kubernetes Operator has a known bug that causes the upgrade
process to fail if the repository for images contains a colon (:
). For example,
using a repository URL like repo:5000/myrepomongo
results in an upgrade failure.
This issue affects versions 1.17 through 1.19.0. However, it is fixed in 1.19.1.
Upgrade using Kubernetes
The following steps depend on how your environment is configured:
Upgrade the CustomResourceDefinitions for MongoDB deployments.
Invoke the following kubectl command:
kubectl replace -f crds.yaml
Optional: Customize the Kubernetes Operator YAML before upgrading it.
To learn about optional Kubernetes Operator installation settings, see Operator kubectl and oc Installation Settings.
Note
To enable the Public Preview of static containers, which improve and simplify security, see Static Containers (Public Preview). We don't recommend using this feature in production while it's in Public Preview.
Specify the spec.opsManager.configMapRef.name
or the spec.cloudManager.configMapRef.name
settings:
Open the MongoDB Database Resource Specification in the editor of your choice.
Add the value to the
spec.opsManager.configMapRef.name
setting or thespec.cloudManager.configMapRef.name
setting and save the specification.
Update to the latest version of the MongoDB Helm Charts for Kubernetes.
helm repo update mongodb
Specify the spec.opsManager.configMapRef.name
or the spec.cloudManager.configMapRef.name
settings:
Open the MongoDB Database Resource Specification in the editor of your choice.
Add the value to the
spec.opsManager.configMapRef.name
setting or thespec.cloudManager.configMapRef.name
setting and save the specification.
Optional: Customize your Helm Chart before upgrading it.
To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.
Note
To enable the Public Preview of static containers, which improve and simplify security, see Static Containers (Public Preview). We don't recommend using this feature in production while it's in Public Preview.
To upgrade the Kubernetes Operator on a host not connected to the Internet:
Specify the spec.opsManager.configMapRef.name
or the spec.cloudManager.configMapRef.name
settings:
Open the MongoDB Database Resource Specification in the editor of your choice.
Add the value to the
spec.opsManager.configMapRef.name
setting or thespec.cloudManager.configMapRef.name
setting and save the specification.
Optional: Customize your Helm Chart before upgrading it.
To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.
Note
To enable the Public Preview of static containers, which improve and simplify security, see Static Containers (Public Preview). We don't recommend using this feature in production while it's in Public Preview.
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:
Upgrade the CustomResourceDefinitions for MongoDB deployments.
Invoke the following oc command:
oc replace -f crds.yaml
Optional: Customize the Kubernetes Operator YAML before upgrading it.
To learn about optional Kubernetes Operator installation settings, see Operator kubectl and oc Installation Settings.
Note
To enable the Public Preview of static containers, which improve and simplify security, see Static Containers (Public Preview). We don't recommend using this feature in production while it's in Public Preview.
Specify the spec.opsManager.configMapRef.name
or the spec.cloudManager.configMapRef.name
settings:
Open the MongoDB Database Resource Specification in the editor of your choice.
Add the value to the
spec.opsManager.configMapRef.name
setting or thespec.cloudManager.configMapRef.name
setting and save the specification.
Upgrade to the new version of the Kubernetes Operator.
Invoke the following oc command:
oc apply -f mongodb-enterprise-openshift.yaml
Update to the latest version of the MongoDB Helm Charts for Kubernetes.
helm repo update mongodb
Specify the spec.opsManager.configMapRef.name
or the spec.cloudManager.configMapRef.name
settings:
Open the MongoDB Database Resource Specification in the editor of your choice.
Add the value to the
spec.opsManager.configMapRef.name
setting or thespec.cloudManager.configMapRef.name
setting and save the specification.
Optional: Customize your Helm Chart before upgrading it.
To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.
Note
To enable the Public Preview of static containers, which improve and simplify security, see Static Containers (Public Preview). We don't recommend using this feature in production while it's in Public Preview.
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:
Specify the spec.opsManager.configMapRef.name
or the spec.cloudManager.configMapRef.name
settings:
Open the MongoDB Database Resource Specification in the editor of your choice.
Add the value to the
spec.opsManager.configMapRef.name
setting or thespec.cloudManager.configMapRef.name
setting and save the specification.
Optional: Customize your Helm Chart before upgrading it.
To learn about optional Kubernetes Operator installation settings, see Operator Helm Installation Settings.
Note
To enable the Public Preview of static containers, which improve and simplify security, see Static Containers (Public Preview). We don't recommend using this feature in production while it's in Public Preview.
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.