Navigation

MongoDB Plugin Reference

Use the kubectl mongodb plugin to:

Before you begin, install the kubectl mongodb plugin.

The kubectl mongodb plugin has the following subcommands:

setup Subcommand

The kubectl mongodb multicluster setup subcommand sets up the initial multi-Kubernetes-cluster deployment. It performs the following actions:

  • Creates a default ConfigMap named mongodb-enterprise-operator-member-list that contains all the member clusters of the multi-Kubernetes-cluster deployment. This name is hard-coded and you can’t change it. See Known Issues.
  • Creates service accounts, Roles, and RoleBindings in the central cluster and each member cluster.
  • Applies the correct permissions for service accounts.
  • Uses the preceding settings to create your multi-Kubernetes-cluster deployment.

setup Subcommand Options

The setup subcommand of the kubectl mongodb plugin has the following options:

Option Data Type Description
central-cluster string Required. Central cluster that the Kubernetes Operator will be deployed in, such as: --central-cluster="MDB_CENTRAL_CLUSTER_FULL_NAME".
central-cluster-namespace string Required. Namespace that the Kubernetes Operator will be deployed to, such as: --central-cluster-namespace="mongodb".
cleanup boolean Optional. Flag that indicates whether to delete all previously created resources except for namespaces. Default value is false.
cluster-scoped boolean Optional. Flag that indicates whether to create ClusterRole and ClusterRoleBindings for member clusters. Default value is false.
create-service-account-secrets boolean Optional. Flag that indicates whether to create secrets for the service accounts in the Kubernetes API server. Default value is false.
install-database-roles boolean Optional. Flag that indicates whether to install the ServiceAccounts and Roles required for running MongoDB workloads on the member clusters. Default value is false.
member-clusters string Required. Comma-separated list that contains member clusters, such as: -member-clusters="${MDB_CLUSTER_2_FULL_NAME}, ${MDB_CLUSTER_3_FULL_NAME}, ${MDB_CLUSTER_4_FULL_NAME}".
member-cluster-namespace string Required. Namespace that the member cluster resources will be deployed to, such as: -member-cluster-namespace="mongodb".
service-account string Optional. Name of the service account for the Kubernetes Operator to use to communicate with the member clusters. Default value is mongodb-enterprise-operator-multi-cluster.

For a full example of the kubectl mongodb plugin setup subcommand’s usage, see the multi-Kubernetes-cluster quick start.

recover Subcommand

The kubectl mongodb multicluster subcommand can automatically recover a failed cluster topology in some cases. In other cases, you must manually recover from a failure. To learn more, see Disaster Recovery.

recover Subcommand Options

The recover subcommand of the kubectl mongodb plugin has the following options:

Option Data Type Description
central-cluster string Required. Central cluster that the Kubernetes Operator will be deployed in, such as: --central-cluster="MDB_CENTRAL_CLUSTER_FULL_NAME".
central-cluster-namespace string Required. Namespace that the Kubernetes Operator will be deployed to, such as: --central-cluster-namespace="mongodb".
cleanup boolean Optional. Flag that indicates whether to delete all previously created resources except for namespaces. Default value is false.
cluster-scoped boolean Optional. Flag that indicates whether to create ClusterRole and ClusterRoleBindings for member clusters. Default value is false.

For a full example of the kubectl mongodb plugin recover subcommand’s usage, see the manual disaster recovery procedure.