<p>I'm running kubernetes in azure.
I want to delete a specific deployment, with AZ AKS or kubectl.</p>

<p>The only info I've found is how to delete pods, but this is not what I'm looking for, since pods will regenerate once deleted. </p>

<p>I know I just can go to the ui and delete the deployment but i want to do it with az aks or kubectl.</p>

<p><a href="https://i.stack.imgur.com/yIKzF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yIKzF.png" alt="enter image description here"></a></p>

<p>I've run</p>

<pre><code>kubectl get all -A
</code></pre>

<p><a href="https://i.stack.imgur.com/JMyPO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JMyPO.png" alt="enter image description here"></a></p>

<p>Then I copy the name of the deployment that I want to delete and run:</p>

<pre><code>kubectl delete deployment zr-binanceloggercandlestick-btcusdt-2hour

kubectl delete deployment deployment.apps/zr-binanceloggercandlestick-btcusdt-12hour
</code></pre>

<p>but noting no success, i get these errors:</p>

<pre><code>Error from server (NotFound): deployments.extensions "zr-binanceloggercandlestick-btcusdt-2hour" not found


error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'C:\Users\amnesia\.azure-kubectl\kubectl.exe get resource/&lt;resource_name&gt;' instead of 'C:\Users\amnesia\.azure-kubectl\kubectl.exe get resource resource/&lt;resource_name&gt;'
</code></pre>

<p><a href="https://i.stack.imgur.com/QJJdr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QJJdr.png" alt="enter image description here"></a></p>

<p>Find out all deployments across all namespaces</p>

<pre><code>kubectl get deploy -A
</code></pre>

<p>Then delete a deployment with deploymentname from namespace. deploymentname can be found from above command.</p>

<pre><code>kubectl delete deploy deploymentname -n namespacename
</code></pre>

<p><a href="https://learn.microsoft.com/en-us/azure/aks/kubernetes-walkthrough#connect-to-the-cluster" rel="noreferrer">Docs</a> on how to configure kubectl to connect to AKS.</p>
