kcp migration init
kcp migration init¶
Initialize a new migration
Synopsis¶
Initialize a new migration by validating infrastructure and persisting migration state.
The migration is described by a single kind: GatewayMigration YAML file — the source
and destination topology, the cluster link, the gateway CRs, and the credentials for each
connection leg. See docs/assets/gateway-examples/gateway-migration.yaml.
This command validates the cluster link and mirror topics on the destination cluster, fetches the current gateway CR from Kubernetes, validates the initial, fenced and switchover gateway CRs against each other — including that the Kubernetes secrets they reference exist in the namespace — and writes the migration configuration to the state file.
Validating up front matters because the alternative is discovering the problem at cutover, after client traffic has already been fenced.
The state file can then be used by 'kcp migration execute' to run the migration.
metadata.name in the manifest is the migration's identity and is written into the state file's migration_id, so re-running init updates that migration rather than creating a second one. Init refuses to overwrite a migration that is already past the point of no return; run 'kcp migration execute' there instead — it proceeds with the edited spec (warning loudly) rather than discarding the state a live cutover needs.
The manifest is secret-bearing when credentials are written inline. Keep it 0600, or reference a credentials file and/or use ${ENV_VAR} interpolation (interpolate: true).
Examples¶
# Initialize from a manifest
kcp migration init --migration-yaml gateway-migration.yaml
# Register the migration without contacting the gateway or destination
kcp migration init --migration-yaml gateway-migration.yaml --skip-validate
Options¶
-h, --help help for init
--migration-state-file string The path to the migration state file. If it doesn't exist, it will be created. If it exists, the new migration will be appended. (default "migration-state.json")
--migration-yaml string Path to the GatewayMigration manifest describing this migration.
--skip-validate Skip infrastructure validation. Creates migration metadata without resolving credentials or validating gateway/Kubernetes resources. Useful for testing.
Options inherited from parent commands¶
SEE ALSO¶
- kcp migration - Commands for migrating using CPC Gateway.