Remove a Network Operator Deployment¶
Use l8k clean to tear down the Network Operator deployment on one Kubernetes
cluster. The command removes custom resources first so the installed
controllers can process their finalizers, then uninstalls the Helm release.
The command is destructive and asks for confirmation before changing the cluster. Verify the kubeconfig and the displayed target namespace before confirming.
The kubeconfig identity must be able to list CRDs cluster-wide, list, get, and delete the selected custom resources, and manage the Helm release in the target namespace. Cluster-administrator access normally satisfies this requirement.
Namespace Resolution¶
The first available namespace source wins:
--network-operator-namespace <namespace>networkOperator.namespacein--user-configor./cluster-config.yamlnetworkOperator.namespacein an explicit--config-dir/l8k-config.yamlnvidia-network-operator
Custom installation namespaces must be supplied by flag or trusted local config. Cleanup deliberately does not infer a destructive target from user-creatable in-cluster objects such as Helm release Secrets. The config is read only for the namespace; stale release settings elsewhere in the file do not block cleanup.
Deletion Boundary¶
Cleanup performs these operations in order:
- Discover every namespaced CRD served by the cluster and delete all of its custom-resource instances in the resolved operator namespace.
- Delete all instances of the Network Operator's known cluster-scoped CR
kinds:
HostDeviceNetwork,IPoIBNetwork,MacvlanNetwork,NicNodePolicy, andNicClusterPolicy.NicClusterPolicyis deleted last. - Re-scan the operator namespace and the known cluster-scoped kinds, removing any custom resources created or exposed during policy teardown.
- Wait until all selected custom resources are gone, including finalizer processing.
- Uninstall the
network-operatorHelm release and wait for Helm-managed resources to be removed.
Because step 1 intentionally covers every custom-resource kind, do not keep unrelated custom resources in the Network Operator namespace. Cluster-scoped resources cannot be associated with a namespace, so every live instance of the five listed kinds is removed.
The command preserves:
- The resolved namespace
- CustomResourceDefinitions
- Secrets not owned by the Helm release, including unrelated registry credentials
- Custom resources outside the resolved namespace, except the five explicitly listed cluster-scoped kinds
- Generated configuration and deployment files on disk
When Helm is uninstalled, Helm release metadata and any Secret rendered as a chart-managed resource are removed with the release.
Missing CRDs, custom resources, or the Helm release are treated as successful no-ops, making the command safe to re-run after a partial cleanup.
Keep the Helm Release¶
Use --keep-helm-chart to remove the custom resources while leaving the
Network Operator release and its chart-managed resources installed:
This option does not narrow the custom-resource deletion boundary.
Automation¶
JSON output is non-interactive and auto-confirms the cleanup. Use it only when the target has already been reviewed:
A successful result includes the resolved namespace, the number of deleted
custom resources, whether Helm removed a release, and whether
--keep-helm-chart was requested: