1

I have stuck resources after delete a jitsi stack in my master node. The only pending resources are this two statefullset.appsset, no pods are running.

My issue

If I execute the command:

kubectl delete statefulsets shard-0-jvb -n jitsi --force --grace-period=0 --cascade=orphan

The console freezes for hours and resources are not removed.

Any other way to force the destroying process?

The stack was created with Kustomize.

enter image description here

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37
Miguel Conde
  • 813
  • 10
  • 22
  • 1
    Check for finalizers in the object, those can't be skipped even with force and friends but you can `kubectl edit` to get rid of them. But of course if there is a stuck finalizer that usually means some other component isn't running which was going to do some kind of cleanup step that you'll be skipping so caveat emptor. – coderanger Aug 19 '21 at 04:47
  • Try to delete the statefull set yaml, kubectl delete -f – SVD Aug 19 '21 at 06:04
  • I have a lot of files in my directory because is a deploy with kustomize, the execution of kubectl delete -f - it also stays in the console without doing anything – Miguel Conde Aug 19 '21 at 17:21
  • @MiguelConde have you tried what coderanger suggested? You can describe your stateful set and you will find `finalizer`. Also please refer to [Delete a StatefulSet](https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/) and [Force Delete StatefulSet Pods](https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/) – moonkotte Aug 20 '21 at 08:31

1 Answers1

1

Posting the answer as community wiki, feel free to edit and expand.


Stuck objects in general

Sometimes objects can't be deleted due to finalizer(s), you will need to find them by viewing at the whole object e.g. kubectl get pod pod-name -o json.

Then there are two options:

  1. fix what prevents dependent object to be deleted (for instance it was metrics server - see another answer on SO)

  2. if it's not possible to fix, then finalizer should be removed manually by kubectl edit resource_type resouce_name

Stuck statefulsets

Kubernetes documentation has two parts related to deleting statefulsets (it's a bit more complicated since usually they have persistent volumes as well).

Useful links:

moonkotte
  • 3,661
  • 2
  • 10
  • 25