Navigation

Multi-Cluster CLI Reference

Use the multi-cluster CLI to set up multi-Kubernetes-cluster deployments and run automatic and manual disaster recovery.

The multi-cluster CLI has the following subcommands:

The setup Subcommand

The go run main.go setup subcommand sets up the initial multi-Kubernetes-cluster deployment. It performs the following actions:

  • Creates a single mongodb namespace in the central cluster and each member cluster.
  • Creates Service Accounts, Roles, and RoleBindings in the central cluster and each member cluster.
  • Applies the correct permissions for service accounts.
  • Uses these settings to create your multi-Kubernetes-cluster deployment.

The setup Subcommand Options

The setup subcommand of the multi-cluster CLI has the following options:

Option Data Type Description
central-cluster string 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.
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 multi-cluster CLI setup subcommand’s usage, see the multi-Kubernetes-cluster quick start procedure.

The recover Subcommand

The go run main.go recover 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.

The recover Subcommand Options

The recover subcommand of the multi-cluster CLI has the following options:

Option Data Type Description
central-cluster string 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 multi-cluster CLI recover subcommand’s usage, see the manual disaster recovery procedure.