How to Use Kubectl Delete Deployment in Kubernetes

<p>In this short article, we will discuss how to use the&nbsp;<code>kubectl delete deployment</code>&nbsp;command in Kubernetes (K8S), explaining how to use it in a step-by-step format with examples.</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:700/0*CK2rU1i7GTA5On2x" style="height:394px; width:700px" /></p> <p>Photo by&nbsp;<a href="https://unsplash.com/@melocokr?utm_source=medium&amp;utm_medium=referral" rel="noopener ugc nofollow" target="_blank">Sam Pak</a>&nbsp;on&nbsp;<a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral" rel="noopener ugc nofollow" target="_blank">Unsplash</a></p> <h2>How to use kubectl delete deployment command</h2> <ol> <li>Open a terminal or command prompt and connect to your K8S cluster.</li> <li>View a list of deployments with the&nbsp;<code>kubectl get deployments</code>&nbsp;command. Use the&nbsp;<code>-n &lt;namespace&gt;</code>&nbsp;flag to specify the namespace of the deployment.</li> <li>Delete the deployment with the&nbsp;<code>kubectl delete deployment &lt;deployment name&gt; -n &lt;namespace name&gt;.</code>&nbsp;For example, if you had a deployment named&nbsp;<code>blog-deployment</code>&nbsp;in the&nbsp;<code>blog</code>&nbsp;namespace, you would run&nbsp;<code>kubectl delete deployment blog-deployment -n blog</code>&nbsp;.</li> </ol> <p><a href="https://jackwesleyroper.medium.com/how-to-use-kubectl-delete-deployment-in-kubernetes-fe81ba30f355"><strong>Visit Now</strong></a></p>
Tags: kubectl Delete