k8s-launch-kit-clean
Skill18 starsChanged 48 days agoApache-2.0View on GitHub
Remove an NVIDIA Network Operator deployment from a Kubernetes cluster with l8k clean. Use when the user explicitly asks to uninstall, tear down, remove, reset, or clean a Network Operator installation, delete its custom resources, or keep the Helm chart while clearing Network Operator CRs.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
- k8s-launch-kit-configSkill
- k8s-launch-kit-deploySkill
- k8s-launch-kit-discoverSkill
- k8s-launch-kit-dryrunSkill
- k8s-launch-kit-generateSkill
- k8s-launch-kit-pipelineSkill
- k8s-launch-kit-sharedSkill
- k8s-launch-kit-troubleshootSkill
- k8s-launch-kit-validateSkill
- k8s-network-engineerSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Read k8s-launch-kit-shared first for binary discovery, JSON output, and error handling.
- Distinctive: line 18
Treat cleanup as an irreversible live-cluster mutation.
- Distinctive: line 30
Use read-only checks when the target is not already explicit:
- Distinctive: line 37
Stop and ask for direction if the kubeconfig, cluster, namespace, or Helm retention choice remains ambiguous.
- Very specific: line 72
Check the command status before parsing and retain cleanup.log on failure.
- Distinctive: line 94
Do not manually strip finalizers as part of the normal workflow.
- Very specific: line 110
If the Helm release was meant to be removed, verify it is absent with the same read-only helm list command.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Clean a Network Operator Deployment
Read k8s-launch-kit-shared first for binary discovery, JSON output, and error
handling.
Component external ownership adds no DaemonSet or host-file deletion. NCP removal still tears down its operator-owned children and is not a component ownership migration. The existing broad CR deletion boundary can include NADs in the selected namespace. See external networking.
Safety Boundary
Treat cleanup as an irreversible live-cluster mutation. Require explicit user authority to remove the deployment. Do not infer cleanup authority from a request to inspect, validate, troubleshoot, or explain the command.
Before running it:
- Resolve the intended kubeconfig and show its current context.
- Determine the intended Network Operator namespace.
- Explain that all namespaced custom resources in that namespace and every known cluster-scoped Network Operator CR will be deleted.
- Confirm whether the Helm release should be uninstalled or retained.
Use read-only checks when the target is not already explicit:
kubectl --kubeconfig <PATH> config current-context
helm --kubeconfig <PATH> list --all-namespaces --filter '^network-operator$'Stop and ask for direction if the kubeconfig, cluster, namespace, or Helm retention choice remains ambiguous.
Run Cleanup
An AI agent uses JSON mode after the user authorizes the exact target:
l8k clean \
--kubeconfig <PATH> \
--network-operator-namespace <NAMESPACE> \
--output json >cleanup.json 2>cleanup.log &&
jq . cleanup.jsonOmit --network-operator-namespace only when the user expects l8k to resolve
it from --user-config, ./cluster-config.yaml, an explicit --config-dir,
or the nvidia-network-operator default. l8k does not trust in-cluster objects
to select a destructive cleanup target. The same trusted local config supplies
networkOperator.skipHelmChart; when true, l8k treats the Helm release as
externally owned and retains it.
To retain the installed release and its chart-managed resources:
l8k clean \
--kubeconfig <PATH> \
--network-operator-namespace <NAMESPACE> \
--keep-helm-chart \
--output json >cleanup.json 2>cleanup.log &&
jq . cleanup.jsonJSON mode auto-confirms. Do not invoke it until the read-only target checks and
authorization are complete. l8k clean has no dry-run mode.
Check the command status before parsing and retain cleanup.log on failure;
see the capture recipe in docs/integrator/automation.md.
Deletion Semantics
The command:
- Deletes every namespaced custom-resource instance in the resolved operator namespace.
- Deletes all
HostDeviceNetwork,IPoIBNetwork,MacvlanNetwork,NicNodePolicy, andNicClusterPolicyinstances cluster-wide. - Sends deletion requests to the complete namespaced and cluster-scoped set before monitoring any CR for finalizer completion, then uses the same delete-all-then-wait ordering for re-sweeps.
- Keeps controllers installed until CR deletion and finalizers complete.
- Uninstalls the
network-operatorHelm release last unlessnetworkOperator.skipHelmChartor--keep-helm-chartretains it. - Preserves the namespace, CRDs, Secrets not owned by Helm, local files, and namespaced custom resources elsewhere. Helm metadata and chart-managed resources are removed with the release.
- Treats already-missing resources and Helm releases as successful no-ops.
Do not manually strip finalizers as part of the normal workflow. If cleanup waits indefinitely, inspect the affected CR, operator pods, and events; request separate authority before forcing finalizer removal.
Verify the Result
Require .success == true, then report:
.cleanup.namespace.cleanup.customResourcesDeleted.cleanup.helmReleaseRemoved.cleanup.keepHelmChart
cleanup.keepHelmChart is the effective policy from config plus the explicit
flag, not merely whether --keep-helm-chart appeared on the command line.
If the Helm release was meant to be removed, verify it is absent with the same
read-only helm list command. If it was kept, verify it remains deployed.
OpenShift
l8k clean --flavor ocp is rejected. The broad Kubernetes cleanup does not cover separately installed OpenShift operators; remove only exact intended resources manually.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

