<p>I am using <code>kubectl</code>. How to find dangling resources by the namespace?</p>
<p>For example, I have some namespaces.</p>
<pre><code>kubectl get ingress --all-namespaces |awk '{print $1}'
</code></pre>
<p>That is supposed to be deleted. If I find those namespaces on GKE there is no result returned.</p>
<p>So why <code>kubectl</code> are me showing those namespaces?</p>

Rodrigo
<p>You can find dangling resources on a particular namespace with the following command:</p>
<pre><code>kubectl api-resources --verbs=list --namespaced -o name \
  | xargs -n 1 kubectl get --show-kind --ignore-not-found -n &lt;namespace&gt;
</code></pre>
<p>If you need to force the namespace deletion, you can do so by removing the <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/" rel="nofollow noreferrer">Finalizer</a>:</p>
<p>1.</p>
<pre><code>kubectl get namespace &lt;namespace&gt; -o json &gt; &lt;namespace&gt;.json
</code></pre>
<ol start="2">
<li></li>
</ol>
<pre><code>kubectl replace --raw &quot;/api/v1/namespaces/&lt;namespace&gt;/finalize&quot; -f ./&lt;namespace&gt;.json
</code></pre>
