<p>I am getting issue while terminating the namesapce in the cluster, It's showing many parameters inside the namespace JSON. I followed this link <a href="https://medium.com/@craignewtondev/how-to-fix-kubernetes-namespace-deleting-stuck-in-terminating-state-5ed75792647e" rel="noreferrer">https://medium.com/@craignewtondev/how-to-fix-kubernetes-namespace-deleting-stuck-in-terminating-state-5ed75792647e</a></p>
<pre><code> &quot;spec&quot;: {},
    &quot;status&quot;: {
        &quot;conditions&quot;: [
            {
                &quot;lastTransitionTime&quot;: &quot;2021-01-11T08:41:48Z&quot;,
                &quot;message&quot;: &quot;All resources successfully discovered&quot;,
                &quot;reason&quot;: &quot;ResourcesDiscovered&quot;,
                &quot;status&quot;: &quot;False&quot;,
                &quot;type&quot;: &quot;NamespaceDeletionDiscoveryFailure&quot;
            },
            {
                &quot;lastTransitionTime&quot;: &quot;2021-01-11T08:41:48Z&quot;,
                &quot;message&quot;: &quot;All legacy kube types successfully parsed&quot;,
                &quot;reason&quot;: &quot;ParsedGroupVersions&quot;,
                &quot;status&quot;: &quot;False&quot;,
                &quot;type&quot;: &quot;NamespaceDeletionGroupVersionParsingFailure&quot;
            },
            {
                &quot;lastTransitionTime&quot;: &quot;2021-01-11T08:41:48Z&quot;,
                &quot;message&quot;: &quot;All content successfully deleted, may be waiting on finalization&quot;,
                &quot;reason&quot;: &quot;ContentDeleted&quot;,
                &quot;status&quot;: &quot;False&quot;,
                &quot;type&quot;: &quot;NamespaceDeletionContentFailure&quot;
            },
            {
                &quot;lastTransitionTime&quot;: &quot;2021-01-11T08:42:09Z&quot;,
                &quot;message&quot;: &quot;All content successfully removed&quot;,
                &quot;reason&quot;: &quot;ContentRemoved&quot;,
                &quot;status&quot;: &quot;False&quot;,
                &quot;type&quot;: &quot;NamespaceContentRemaining&quot;
            },
            {
                &quot;lastTransitionTime&quot;: &quot;2021-01-11T08:41:48Z&quot;,
                &quot;message&quot;: &quot;All content-preserving finalizers finished&quot;,
                &quot;reason&quot;: &quot;ContentHasNoFinalizers&quot;,
                &quot;status&quot;: &quot;False&quot;,
                &quot;type&quot;: &quot;NamespaceFinalizersRemaining&quot;
            }
        ],
        &quot;phase&quot;: &quot;Terminating&quot;
    }
}```
</code></pre>

rajendra sharma
<p>I have found the answer to terminate the stuck namespace.</p>
<pre class="lang-sh prettyprint-override"><code>for ns in $(kubectl get ns --field-selector status.phase=Terminating -o jsonpath='{.items[*].metadata.name}')
do
  kubectl get ns $ns -ojson | jq '.spec.finalizers = []' | kubectl replace --raw &quot;/api/v1/namespaces/$ns/finalize&quot; -f -
done

for ns in $(kubectl get ns --field-selector status.phase=Terminating -o jsonpath='{.items[*].metadata.name}')
do
  kubectl get ns $ns -ojson | jq '.metadata.finalizers = []' | kubectl replace --raw &quot;/api/v1/namespaces/$ns/finalize&quot; -f -
done
</code></pre>
