Clean Up Kubernetes Nodes

You can clean up file system changes made by the bootstrap container.
If the nsx-node-agent DaemonSet is removed, OVS is no longer running on the host (in the container or in the host's PID).

Procedure for NCP 2.5.0

To undo the changes made by the bootstrap container by performing the following steps:
  • Remove NSX-CNI:
    • Remove
      /etc/cni/net.d/10-nsx.conf
      .
    • Remove
      /etc/cni/net.d/99-loopback.conf
      .
    • On RHEL only, remove
      /opt/cni/bin/loopback
      .
    • Remove
      /opt/cni/bin/nsx
      .
    • On Ubuntu only, run the following commands:
      apparmor_parser -R /etc/apparmor.d/ncp-apparmor rm -rf /etc/apparmor.d/ncp-apparmor sudo /etc/init.d/apparmor reload
  • Remove NSX-installed OVS kmod:
    OVS kmod includes the following files:
    openvswitch.ko vport-geneve.ko vport-gre.ko vport-lisp.ko vport-stt.ko vport-vxlan.ko
    • Find your running kernel version with the command
      uname -r
      .
    • On RHEL only, remove all the OVS kmod files from
      /lib/modules/${kversion}/weak-updates/openvswitch
      .
    • On Ubuntu only, remove all the OVS kmod files from
      /lib/modules/${kversion}/updates/dkms
      .
    • Go to
      /lib/modules/${kversion}/nsx
      and see if the directory
      usr-ovs-kmod-backup
      exists. If it does, you had a custom OVS kernel module installed. Perform the following steps:
      • Go to
        /lib/modules/${kversion}/nsx/usr-ovs-kmod-backup
        .
      • Find the file named
        INFO
        . It contains the path where the files can be found. Use this path to restore the files.
      • Run the command
        depmod
        .
      • Run the command
        /usr/share/openvswitch/scripts/ovs-ctl force-reload-kmod --system-id=random
        if OVS is installed on the host machine.

Procedure for NCP 2.5.1 and later

You can create the nsx-ncp-cleanup DaemonSet to undo the system changes made by the nsx-ncp-bootstrap DaemonSet. This DaemonSet must only be created if you previously applied the NCP YAML file (
ncp-ubuntu.yaml
or
ncp-rhel.yaml
) and have not deleted them. Note that the nsx-ncp-cleanup DaemonSet will uninstall NSX CNI, which will result in an invalid Kubernetes node state.
To create the DaemonSet, perform the following steps:
  • Delete the nsx-ncp-bootstrap and nsx-node-agent DaemonSets. For example, you can run the following commands with the appropriate namespace name:
    kubectl delete ds nsx-ncp-bootstrap -n <namespace> kubectl delete ds nsx-node-agent -n <namespace>
  • Run
    kubectl apply -f ncp-cleanup-ubuntu.yaml
    or
    kubectl apply -f ncp-cleanup-rhel.yaml
    , depending on your host OS, from the command line on the Kubernetes master node.
To make the node usable again, run
kubectl apply -f ncp-ubuntu.yaml
or
kubectl apply -f ncp-rhel.yaml
, depending on your host OS.