NCP 4.1.2 or Later
Requirements
- The NSX version is 3.2.0 or later.
- The NCP version is 4.1.2 or later.
- The nsx-ncp deployment must be scaled down to 0 replicas manually.
Migration Steps
A new YAML file named
migrate-mp2p-job.yaml is provided that contains the following Kubernetes resources:
- Two config maps named nsx-ncp-migrate-mp2p-config (also called mp2p-config) and nsx-ncp-migrate-mp2p-user-spec (also called mp2p-user-spec).
- One PersistentVolume with the name nsx-ncp-mp2p-shared-pv and size 500 MB.
- One PersistentVolumeClaim with the name nsx-ncp-mp2p-shared-pvc that requires 500 MB storage.
- One Job with the name nsx-ncp-migrate-mp2p.
Before using the job to migrate a cluster, note that you must scale down the number of nsx-ncp deployment replicas to 0 in all the clusters that share the same NSX network.
Perform the following steps to migrate your vanilla Kubernetes cluster to NSX Policy mode:
- Refactor manually-created DFW sections, if needed. See Dealing with DFW Sections Created by NSX Admin.
- For each cluster to be migrated:
- Add label "dedicated-nsx-ncp-migrate-mp2p=true" to one of the master nodes that has at least 500MB of free disk space. Ensure that only 1 master node has this label.
- Edit migrate-mp2p-job.yaml provided with the build and make the following changes:
- Under the config map nsx-ncp-migrate-mp2p-config: No changes
- Under the config map nsx-ncp-migrate-mp2p-user-spec: Add all the shared resources to be migrated and add the cluster name under "k8s-clusters" (see Migrating Shared Resources and Migrating NCP-Created NSX Resources for the Kubernetes Cluster).
- Add the nsx-secret under "projected-volume" volume under the Job with name nsx-ncp-migrate-mp2p. This is similar to the steps done in nsx-ncp spec (see Edit the NCP YAML File).
- For each cluster to be migrated that shares the same NSX network:
- Scale down the nsx-ncp deployment replicas in nsx-system namespace to 0 wait for nsx-ncp pods to terminate. This can be done in all the clusters in parallel.
- Create an NSX backup.
- For each cluster to be migrated that shares the same NSX network:
- Apply the migrate-mp2p-job.yaml. This should be done in one cluster at a time.
- Once the job nsx-ncp-migrate-mp2p completes successfully, the cluster is migrated to Policy. Otherwise, follow the steps in Failure and Recovery. Migrate the next cluster only after the job nsx-ncp-migrate-mp2p has completed execution for the current cluster.
- Update ncp.ini if required for this cluster. See Migrating Shared Resources.
- Edit the nsx-ncp YAML file or config map and make sure that policy_nsxapi is set to true.
- For each cluster that was migrated to Policy in step 5, follow these steps in parallel:
- If there are Gateway Firewall rules on the top Tier-0 that can block traffic from containers, setting the cfg.CONF.nsx_v3.natfirewallmatch property to BYPASS will avoid firewall enforcement on NCP-created SNAT rules. Otherwise, gateway firewall rules will need to be reviewed to ensure that traffic from containers is not accidentally blocked.
- Apply the nsx-ncp deployment and scale up the nsx-ncp deployment replicas in the nsx-system namespace to the previous state (before step 3)
- Delete the config maps with the names nsx-ncp-migrate-mp2p-config and nsx-ncp-migrate-mp2p-user-spec and Job with the name nsx-ncp-migrate-mp2p under the nsx-system namespace. Delete the PersistentVolumeClaim with the name nsx-ncp-mp2p-shared-pvc and PersistentVolume with the name nsx-ncp-mp2p-shared-pv after the nsx-ncp deployment/pods have been running successfully for at least 12 weeks.
NCP 4.1.1 or Earlier
Requirements
- The NSX version is 3.2.0 or later.
- The NCP version is between 4.0 and 4.1.0.x, inclusive.
- Python3 is installed on the master VM.
- pyyaml is installed on the master VM.
- The script must have execution access to "kubectl".
- NCP must not be running. This will result in control-plane downtime. You must stop NCP manually. The script will not do it.
Migration Steps
The Python3 script that performs the import, mp_to_policy_importer.py, is located in the directory scripts/mp_to_policy_import. It is also referred as mp_to_policy_importer in this document. mp_to_policy_importer must be run on one Kubernetes master node at a time. If it needs to be run again, it must be done on the same master node. mp_to_policy_importer can terminate with the following exit codes:
- 0 - Successful migration to Policy
- 1 - Unsuccessful migration to Policy. NCP should not be run in Manager mode.
- 2 - Unsuccessful migration to Policy. NCP should be restarted in Manager mode.
After the requirements are met, the cluster can be imported to Policy. The steps are:
- In the NCP config file ncp.ini, make sure that policy_nsxapi is set to false.
- Start the migration coordinator on any of the NSX Managers with the following command:
/etc/init.d/migration-coordinator start
Verify that it is successfully running with the following command:/etc/init.d/migration-coordinator status
Be sure to use this Manager's IP address when importing Manager objects to Policy.
- Refactor manually-created DFW sections, if needed. See Dealing with DFW Sections Created by NSX Admin.
- For each cluster to be migrated that share the same NSX network,
- Scale down the nsx-ncp deployment replicas in nsx-system namespace to 0 wait for nsx-ncp pods to terminate. This can be done in all the clusters in parallel.
- Create an NSX backup.
- Do the following for each cluster to be imported:
- Import shared resources. See Migrating Shared Resources. Verify that mp_to_policy_importer terminated with exit code 0. If not, see Failure and Recovery.
- Import the Kubernetes cluster related resources. See Migrating NCP-Created NSX Resources for the Kubernetes Cluster. Verify that mp_to_policy_importer terminated with exit code 0. If not, see Failure and Recovery.
- Update ncp.ini if required for this cluster. See Migrating Shared Resources.
- In the NCP YAML file, make sure that policy_nsxapi is set to true.
- For each cluster that was migrated to Policy in step 6, follow these steps in parallel:
- Apply the nsx-ncp deployment and scale up the nsx-ncp deployment replicas in nsx-system namespace to previous state (before step 4).
For limitations and workarounds, see Limitations and Workarounds. For information on how to handle errors, see Failure and Recovery.