<p>I have stuck resources after delete a jitsi stack in my master node. The only pending resources are this two <code>statefullset.appsset</code>, no pods are running.</p>
<p><a href="https://i.stack.imgur.com/rZqnr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rZqnr.png" alt="My issue" /></a></p>
<p>If I execute the command:</p>
<pre><code>kubectl delete statefulsets shard-0-jvb -n jitsi --force --grace-period=0 --cascade=orphan
</code></pre>
<p>The console freezes for hours and resources are not removed.</p>
<p>Any other way to force the destroying process?</p>
<p>The stack was created with Kustomize.</p>
<p><a href="https://i.stack.imgur.com/0zPdH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0zPdH.png" alt="enter image description here" /></a></p>

Miguel Conde
<p>Posting the answer as community wiki, feel free to edit and expand.</p>
<hr />
<p><strong>Stuck objects in general</strong></p>
<p>Sometimes objects can't be deleted due to <code>finalizer</code>(s), you will need to find them by viewing at the whole object e.g. <code>kubectl get pod pod-name -o json</code>.</p>
<p>Then there are two options:</p>
<ol>
<li><p>fix what prevents dependent object to be deleted (for instance it was metrics server - see <a href="https://stackoverflow.com/a/68319002/15537201">another answer on SO</a>)</p>
</li>
<li><p>if it's not possible to fix, then <code>finalizer</code> should be removed manually by <code>kubectl edit resource_type resouce_name</code></p>
</li>
</ol>
<p><strong>Stuck statefulsets</strong></p>
<p>Kubernetes documentation has two parts related to deleting statefulsets (it's a bit more complicated since usually they have persistent volumes as well).</p>
<p>Useful links:</p>
<ul>
<li><a href="https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/" rel="nofollow noreferrer">Delete a StatefulSet</a></li>
<li><a href="https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/" rel="nofollow noreferrer">Force Delete StatefulSet Pods</a></li>
</ul>
