# How to Clean Luigi and Kubevirt Stale Entries After disabling the Luigin Plugins

## Problem

After disabling the Luigin plugins, stale network erslated entries are present, which results in pod creation failures with below errors:

{% tabs %}
{% tab title="Pod describe" %}

```javascript
Events:
  Type     Reason          Age                    From     Message
  ----     ------          ----                   ----     -------
  Normal   SandboxChanged  34m (x141 over 64m)    kubelet  Pod sandbox changed, it will be killed and re-created.
  Warning  FailedKillPod   3m52s (x130 over 31m)  kubelet  error killing pod: failed to "KillPodSandbox" for "exxxxxxxx" with KillPodSandboxError: "rpc error: code = Unknown desc = failed to destroy network for sandbox \"xxxx\": plugin type=\"multus\" name=\"multus-cni-network\" failed (delete): Multus: [default/testpod1]: error getting pod: Unauthorized"
```

{% endtab %}
{% endtabs %}

## Environment

* Platform9 Managed Kubernetes- 5.7.0 and higher.

## Procedure

The workaround steps to be followed are:

1. Using network plugin CRD, first disable the networks that are not needed.

{% tabs %}
{% tab title="edit" %}

```javascript
# kubectl edit networkplugins -n luigi-system -o yaml
```

{% endtab %}
{% endtabs %}

2. Comment out the plugins that are not needed and save the CRD. Check for those plugin pods and daemonsets to be deleted automatically.

**Note**- Delete the network plugin CRD for unwanted plugins.

{% tabs %}
{% tab title="yaml" %}

```javascript
# kubectl get networkplugins -A
# kubectl edit networkplugins -n luigi-system -o yaml
```

{% endtab %}
{% endtabs %}

3. Delete the '- teardownPlugins' under finalizers and run the below delete:

{% tabs %}
{% tab title="yaml" %}

```javascript
# kubectl delete networkplugins -n luigi-system   networkplugins-sample-default
```

{% endtab %}
{% endtabs %}

4. And remove multus folders and conf file under /etc/cni/net.d/ on all the nodes:

{% tabs %}
{% tab title="Multus removal" %}

```javascript
# rm -rf 00-multus.conf multus.d/
```

{% endtab %}
{% endtabs %}

5. After all the plugins are commented out and are been deleted, disable the Luigi add-on from UI.

Wait for the add-on to be removed.

{% tabs %}
{% tab title="Verify" %}

```javascript
# kubectl get all -n luigi-systemx
```

{% endtab %}
{% endtabs %}

6. Re-enabling the luigi addon works fine after this.

## Additional Information

An internal jira- PMK-6521 has been file to automate this process. And the fix will be available in upcoming PMK-5.11 version.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmk/how-to/how-to-clean-luigi-and-kubevirt-stale-entries-after-disabling-th.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
