# Testing Logical Cluster Migration This guide explains how to test logical cluster migration in a local development environment. For conceptual background on migration, see [Logical Cluster Migration](../concepts/sharding/migration.md). ## Prerequisites You need a multi-shard kcp environment. The easiest way to set this up is using the `sharded-test-server` tool: ```bash make build WHAT=./cmd/sharded-test-server ./bin/sharded-test-server --number-of-shards=2 ``` This starts a root shard, a secondary shard (`shard-1`), and a front-proxy. ## Enabling the Feature Gate The `LogicalClusterMigration` feature gate must be enabled on all shards. When using `sharded-test-server`, pass the feature gate flag: ```bash ./bin/sharded-test-server --number-of-shards=2 -- --feature-gates=LogicalClusterMigration=true ``` The `--` separates `sharded-test-server` flags from flags passed to the underlying kcp servers. ## Setting Up Test Workspaces 1. **Create a workspace on a specific shard:** ```bash export KUBECONFIG=.kcp/admin.kubeconfig # Create an org workspace (will be scheduled to any available shard) kubectl ws create org --enter # Create a workspace explicitly on the root shard kubectl ws create test-workspace --location-selector name=root ``` 2. **Create some test data:** ```bash kubectl ws org:test-workspace kubectl create configmap test-data --from-literal=key=value kubectl create secret generic test-secret --from-literal=password=secret ``` 3. **Note the logical cluster name:** ```bash kubectl get workspace test-workspace -o jsonpath='{.spec.cluster}' # Example output: 1a2b3c4d5e6f7g8h ``` ## Binding the Migration API The migration API must be bound before you can create `LogicalClusterMigration` resources: ```bash kubectl ws org kubectl apply -f - <