<p>I have a set of Kubernetes pods (Kafka). They have been created by Terraform but somehow, they &quot;fell&quot; out of the state (Terraform does not recognize them) and are wrong configured (I don't need them anyways anymore).</p>
<p><a href="https://i.stack.imgur.com/zyuNP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zyuNP.png" alt="enter image description here" /></a></p>
<p>I now want to remove the pods from the cluster completely now. The main problem is, that even after I kill/delete them they keep being recreated/restarting.</p>
<p>I tried:</p>
<pre><code>kubectl get deployments --all-namespaces
</code></pre>
<p>and then deleted the namespace the pods were in with</p>
<pre><code>kubectl delete -n &lt;NS&gt; deployment &lt;DEPLOY&gt;
</code></pre>
<p>This namespace got removed correctly. Still, if I now try to remove/kill the pods (forced and with cascade) they still re-appear. In the events, I can see they are re-created by kubelet but I don't know why nor how I can stop this behavior.</p>
<p><a href="https://i.stack.imgur.com/4KabW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4KabW.png" alt="enter image description here" /></a></p>
<p>I also checked</p>
<pre><code>kubectl get jobs --all-namespaces
</code></pre>
<p>But there are no resources found. And also</p>
<pre><code>kubectl get daemonsets.app --all-namespaces
kubectl get daemonsets.extensions --all-namespaces
</code></pre>
<p><a href="https://i.stack.imgur.com/T79R4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T79R4.png" alt="enter image description here" /></a></p>
<p>But I don't think that one of those is relevant for the Kafka deployment at all.</p>
<p>What else can I try to remove those pods? Any help is welcome.</p>

Alex
<p>Ok, I was able to find the root cause.</p>
<p>With:</p>
<pre><code>kubectl get all --all-namespaces
</code></pre>
<p>I looked up everything that is related to the name of the pods. In this cause, I found services that were related. After I deleted those services, the pods did not get recreated again.</p>
<p>I still think this is not a good solution to the problem (&quot;Just delete everything that has the same name&quot; ...) and I would be happy if someone can suggest a better solution to resolve this.</p>
