Si nécessaire, vous pouvez exécuter un script pour supprimer tous les objets NSX créés par NCP.

Les fichiers d'installation incluent les scripts de nettoyage suivants :
  • nsx_policy_cleanup.py : utilisez ce script si les ressources NSX ont été créées en utilisant le mode Stratégie.
  • nsx_cleanup.py : utilisez ce script si les ressources NSX ont été créées à l'aide du mode Gestionnaire.

Remarque : dans un environnement vSphere with Tanzu, les scripts de nettoyage sont disponibles sur vCenter Server Appliance dans le répertoire /usr/lib/vmware-wcp.

Avant d'exécuter le script, effectuez les tâches suivantes :
  • Arrêtez NCP.
  • Supprimez toutes les ressources que vous avez créées et qui sont associées aux objets créés par NCP. Le script échouera si vous ne supprimez pas ces objets. Par exemple, si NCP a créé un segment et que vous avez créé une règle et un groupe de pare-feu distribué (DFW) associés au segment, vous devez supprimer la règle et le groupe DFW ou supprimer les associations. Si vous avez attaché des machines virtuelles au segment, vous devez supprimer les machines virtuelles ou les détacher du segment.

Mode Stratégie

Usage: nsx_policy_cleanup.py [options]

Options:
  -h, --help            show this help message and exit
  --mgr-ip=MGR_IP       NSX Manager IP address
  -u USERNAME, --username=USERNAME
                        NSX Manager username, ignored if nsx-cert is set
  -p PASSWORD, --password=PASSWORD
                        NSX Manager password, ignored if nsx-cert is set
  -n NSX_CERT, --nsx-cert=NSX_CERT
                        NSX certificate path
  -k KEY, --key=KEY     NSX client private key path
  --vc-endpoint=VC_ENDPOINT
                        IpAddress or Hostname of VC, ignored if environment
                        variable VC_ENDPOINT is set
  --vc-username=VC_USERNAME
                        Username for the VC ServiceAccount, ignored if
                        environment variable VC_USERNAME is set
  --vc-password=VC_PASSWORD
                        Password for the VC ServiceAccount, ignored if
                        environment variable VC_PASSWORD is set
  --vc-https-port=VC_HTTPS_PORT
                        HTTPS port of VC, ignored if environment variable
                        VC_HTTPS_PORT is set. If not present, 443 default
                        value will be used
  --vc-sso-domain=VC_SSO_DOMAIN
                        SSO Domain of VC, ignored if environment variable
                        VC_SSO_DOMAIN is set. If not present, local default
                        value will be used
  --vc-ca-cert=VC_CA_CERT
                        Specify a CA bundle to verify the VC server
                        certificate. It will be ignored if environment
                        VC_CA_CERT is set
  --vc-insecure         Not verify VC server certificate
  -c CLUSTER, --cluster=CLUSTER
                        Cluster to be removed
  -r, --remove          CAVEAT: Removes NSX resources. If not set will do dry-
                        run.
  --top-tier-router-id=TOP_TIER_ROUTER_ID
                        Specify the top tier router id. Must be specified if
                        top tier router does not have the cluster tag
  --all-res             Also clean up HA switching profile, ipblock, external
                        ippool. These resources could be created by TAS NSX-T
                        Tile
  --no-warning          Disable urllib's insecure request warning
  --status              Check the deletion status, the exit code can be
                        success(0), in progress(EXIT_CODE_IN_PROGRESS or
                        failure(other non-zerovalues)
  --thumbprint=THUMBPRINT
                        Specify one or a list of thumbprint strings to use in
                        verifying the NSX Manager server certificate
Par exemple :
python nsx_policy_cleanup.py --mgr-ip={nsx_mngr_ip} -u admin -p {password} -c {k8s_cluster_name} --no-warning -r

Dans certains cas, le paramètre top-tier-router-id doit être spécifié.

Mode Gestionnaire

Usage: nsx_cleanup.py [options]

Options:
  -h, --help            show this help message and exit
  --mgr-ip=MGR_IP       NSX Manager IP address
  -u USERNAME, --username=USERNAME
                        NSX Manager username, ignored if nsx-cert is set
  -p PASSWORD, --password=PASSWORD
                        NSX Manager password, ignored if nsx-cert is set
  -n NSX_CERT, --nsx-cert=NSX_CERT
                        NSX certificate path
  -k KEY, --key=KEY     NSX client private key path
  -c CLUSTER, --cluster=CLUSTER
                        Cluster to be removed
  -r, --remove          CAVEAT: Removes NSX resources. If not set will do dry-
                        run.
  --top-tier-router-uuid=TOP_TIER_ROUTER_UUID
                        Specify the top tier router uuid. Must be specified if
                        top tier router does not have the cluster tag or for a
                        single-tier1 topology
  --all-res             Also clean up HA switching profile, ipblock, external
                        ippool. These resources could be created by TAS NSX-T
                        Tile
  --no-warning          Disable urllib's insecure request warning
Par exemple :
python nsx_cleanup.py --mgr-ip={nsx_mngr_ip} -u admin -p {password} -c {k8s_cluster_name} --top-tier-router-uuid={top_tier_router_uuid} --no-warning -r