# Uninstalling ECK - hangs forever

**URL:** <https://discuss.elastic.co/t/uninstalling-eck-hangs-forever/215521>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [January 17, 2020, 8:29pm UTC](https://discuss.elastic.co/t/uninstalling-eck-hangs-forever/215521 "2020-01-17T20:29:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [January 17, 2020, 8:29pm UTC](https://discuss.elastic.co/t/uninstalling-eck-hangs-forever/215521/1 "2020-01-17T20:29:10Z")

</div>

Hello World!

I'm tried to follow [Uninstalling ECK | Elastic Cloud on Kubernetes [1.0] | Elastic](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-uninstalling-eck.html), however bellow commands hangs forever:

```
$ kubectl get namespaces --no-headers -o custom-columns=:metadata.name \
> | xargs -n1 kubectl delete elastic --all -n
elasticsearch.elasticsearch.k8s.elastic.co "quickstart" deleted
kibana.kibana.k8s.elastic.co "quickstart" deleted

```

Please advise.

---

<div class="post-metadata">

**Author:** ![Anya\_Sabo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anya_sabo/32/49903_2.png) [@Anya\_Sabo](https://discuss.elastic.co/u/Anya_Sabo)\
**Post date:** [January 17, 2020, 9:25pm UTC](https://discuss.elastic.co/t/uninstalling-eck-hangs-forever/215521/2 "2020-01-17T21:25:10Z")

</div>

Hi @alexus, if you were running an older version than 1.0 and removed the operator already, it is possible that there may be finalizers blocking the deletion. If that's the case you can use `kubectl edit` and remove the finalizers manually which should allow the deletions to go through.

If you're still having issues can you share the version you are running and the manifest of the resource that is hanging?

---

<div class="post-metadata">

**Author:** ![SergeyK](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@SergeyK](https://discuss.elastic.co/u/SergeyK)\
**Post date:** [March 5, 2020, 3:26am UTC](https://discuss.elastic.co/t/uninstalling-eck-hangs-forever/215521/3 "2020-03-05T03:26:28Z")

</div>

Having the same issue. Removing finalizer (kubernetes) in elastic-system namespace didn't help:

> KUBE\_EDITOR="nano" kubectl edit ns elastic-system

These commands help identifying the problems:

> kubectl api-resources --verbs=list --namespace d -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n elastic-system

> kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n elastic-system

Trying to remove things one by one (secretes, configmaps etc)  
Does somebody know the easy way to remove the operator?

---

<div class="post-metadata">

**Author:** ![pebrc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pebrc/32/101790_2.png) [@pebrc](https://discuss.elastic.co/u/pebrc)\
**Post date:** [March 5, 2020, 10:51am UTC](https://discuss.elastic.co/t/uninstalling-eck-hangs-forever/215521/4 "2020-03-05T10:51:47Z")

</div>

> [@SergeyK](#):
>
> KUBE\_EDITOR="nano" kubectl edit ns elastic-system

I think this is a misunderstanding. You are editing the namespace here and are potentially removing Kubernetes internal finalizers. What Anya was referring to were finalizers that older versions of ECK set on the resources managed by ECK itself: `Elasticsearch`, `Kibana` and `APMServer`

If your deinstallation is getting stuck I would recommend checking those resources for finalizers especially if you were running one of the early alpha or beta versions of ECK and removing them manually.

To clarify this manual process should normally not be necessary. But I can think of scenarios where it might:

- you ran an older pre-1.0.0 version of ECK that is no longer running/was deleted but you still have Elasticsearch/Kibana or APM Server resources
- you paused reconciliation of Elasticsearch/Kibana/APM resources
- you are running an older version of ECK but it is not reconciling resources (check the operator logs to find out why)

See also [Troubleshoot ECK | Elastic Cloud on Kubernetes [2.10] | Elastic](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-troubleshooting.html)

---

<div class="post-metadata">

**Author:** ![SergeyK](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@SergeyK](https://discuss.elastic.co/u/SergeyK)\
**Post date:** [March 5, 2020, 3:19pm UTC](https://discuss.elastic.co/t/uninstalling-eck-hangs-forever/215521/5 "2020-03-05T15:19:16Z")

</div>

Thanks @pebrc  
k8s and eck operators are latest (1.0.1). Before removing finalizers I tried:  
kubectl delete -f [https://download.elastic.co/downloads/eck/1.0.1/all-in-one.yaml](https://download.elastic.co/downloads/eck/1.0.1/all-in-one.yaml)  
but that's where I got elastic-system namespace stuck in Terminating status...  
I manually removed all resources from the namespace but it was still in Terminating  
Force deleting `--force --grace-period=0` didn't help, it also stuck...  
The only solution that helped was this:  
Starting kubectl proxy in one terminal:  
`kubectl proxy`  
In another terminal:

> kubectl get ns elastic-system -o json |   
> jq '.spec.finalizers=' |   
> curl -X PUT [http://localhost:8001/api/v1/namespaces/elastic-system/finalize](http://localhost:8001/api/v1/namespaces/elastic-system/finalize) -H "Content-Type: application/json" --data @-

But this issue might be related to Kubernetes itself:

> <https://github.com/kubernetes/kubernetes/issues/77086>
>
> \*\*What happened\*\*:
> 
> There is no way to delete Namespaces stuck in Terminating …if they have finalizers which will never be run.
> 
> \*\*What you expected to happen\*\*:
> 
> There is a way to delete Namespaces stuck in Terminating.
> 
> \*\*How to reproduce it (as minimally and precisely as possible)\*\*:
> 
> Begin with any Kubernetes cluster.
> 
> 1. \`kubectl apply -f\` this YAML
> 
> \`\`\`
> apiVersion: v1
> kind: Namespace
> metadata:
> name: delete-me
> spec:
> finalizers:
> - foregroundDeletion
> \`\`\`
> 
> 2. \`kubectl delete ns delete-me\`
> 
> 3. It is not possible to delete \`delete-me\`.
> 
> The only workaround I've found is to destroy and recreate the entire cluster.
> 
> \*\*Anything else we need to know?\*\*:
> 
> \[Stack Overflow question\](https://stackoverflow.com/questions/55853312/how-to-force-delete-a-kubernetes-namespace) with everything I've tried.
> 
> \*\*Environment\*\*:
> \- Kubernetes version (use \`kubectl version\`):
> \`\`\`
> $ kubectl version
> 
> Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
> Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.8-gke.6", GitCommit:"394ee507d00f15a63cef577a14026096c310698e", GitTreeState:"clean", BuildDate:"2019-03-30T19:31:43Z", GoVersion:"go1.10.8b4", Compiler:"gc", Platform:"linux/amd64"}
> \`\`\`
> 
> \- Cloud provider or hardware configuration: GKE
> \- OS (e.g: \`cat /etc/os-release\`): 
> 
> \`\`\`
> $ cat /etc/os-release
> 
> PRETTY\_NAME="Debian GNU/Linux buster/sid"
> NAME="Debian GNU/Linux"
> ID=debian
> HOME\_URL="https://www.debian.org/"
> SUPPORT\_URL="https://www.debian.org/support"
> BUG\_REPORT\_URL="https://bugs.debian.org/"
> \`\`\`
> 
> \- Kernel (e.g. \`uname -a\`):
> 
> \`Linux \[hostname\] 4.19.28-2rodete1-amd64 #1 SMP Debian 4.19.28-2rodete1 (2019-03-18 \> 2018) x86\_64 GNU/Linux\`

---

<div class="post-metadata">

**Author:** ![pebrc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pebrc/32/101790_2.png) [@pebrc](https://discuss.elastic.co/u/pebrc)\
**Post date:** [March 5, 2020, 4:30pm UTC](https://discuss.elastic.co/t/uninstalling-eck-hangs-forever/215521/6 "2020-03-05T16:30:25Z")

</div>

> [@SergeyK](#):
>
> But this issue might be related to Kubernetes itself:

Yes, you are right. I think I misunderstood your problem. In version 1.0.1 ECK does not use finalizers anymore.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 7:41am UTC](https://discuss.elastic.co/t/uninstalling-eck-hangs-forever/215521/7 "2022-11-04T07:41:09Z")

</div>


