对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

migrate-to-mck 插件命令参考

The kubectl mongodb plugin's migrate-to-mck command generates the Kubernetes custom resources you need to migrate a self-managed deployment into Kubernetes under Kubernetes Operator. It has two subcommands: mongodb, which generates the MongoDB resource, and users, which generates MongoDBUser resources.

这两个子命令在生成任何输出之前都会验证源自动化配置,并在出现任何阻塞问题时以非零状态退出。两者都支持缺失值的交互式提示,以及当您提供所有必需标志时的完全非交互式模式。

Generates the MongoDB custom resource for the migration target.

标记
必需
说明

--config-map-name

Name of the Ops Manager or Cloud Manager project ConfigMap.

--secret-name

Name of the Secret that holds the Ops Manager or Cloud Manager API key.

--namespace

No

Kubernetes namespace for the generated resource. Defaults to default.

-o, --output

No

要写入生成的资源的文件路径。

--certs-secret-prefix

仅当启用 TLS 时

Sets spec.security.certsSecretPrefix on the generated resource, and suppresses the interactive prompt for this value.

--prometheus-secret-name

仅当启用 Prometheus 时

Name of a pre-created Secret that contains a password key, used for Prometheus scraping credentials.

--resource-name-override

No

Sets metadata.name on the generated resource. When the source replica set name is not a valid Kubernetes name, the plugin normalizes it automatically and sets spec.replicaSetNameOverride for you.

Generates MongoDBUser resources for the migration target's authenticated users.

标记
必需
说明

--config-map-name

Name of the Ops Manager or Cloud Manager project ConfigMap.

--secret-name

Name of the Secret that holds the Ops Manager or Cloud Manager API key.

--namespace

No

Kubernetes namespace for the generated resources. Defaults to default.

-o, --output

No

要写入生成的资源的文件路径。

--users-secrets-file

No

Path to a CSV file that maps SCRAM users to Secrets. Each line uses the form username:database,secret-name. If you omit this flag, the plugin prompts you for a Secret name for each user, and suggests <username>-password as the default.

--resource-name-override

No

Name of the MongoDB resource that the generated MongoDBUser resources reference through mongodbResourceRef.name. Defaults to the normalized replica set name.

注意

该插件会根据 $external数据库为 X.509 和LDAP用户生成 MongoDBUser 资源。该插件会跳过自动化代理用户。

在运行任一子命令之前,请创建以下Kubernetes对象:

  • A project ConfigMap with baseUrl, orgId, and projectName keys.

  • An API-key Secret with publicKey and privateKey keys.

  • One Secret per SCRAM user, each with a password key.

  • If Prometheus is enabled, a Secret with a password key for the Prometheus scrape credentials.

  • 如果已启用 TLS:

    • A <resourceName>-ca ConfigMap with a ca-pem key.

    • A kubernetes.io/tls Secret named <certsSecretPrefix>-<resourceName>-cert.

  • 如果已启用 X.509代理身份验证,则会生成名为 <certsSecretPrefix>-<resourceName>-agent-certsSecret