{"id":5309,"date":"2024-09-18T03:49:19","date_gmt":"2024-09-18T03:49:19","guid":{"rendered":"https:\/\/linuxbuz.com\/?p=5309"},"modified":"2024-10-12T13:49:21","modified_gmt":"2024-10-12T13:49:21","slug":"kubectl-delete-pod","status":"publish","type":"post","link":"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod","title":{"rendered":"Kubectl Delete Pod: How to Delete\/Drain Pods from a Kubernetes Node"},"content":{"rendered":"<p style=\"text-align: justify;\">In Kubernetes, a <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/pods\/\" target=\"_blank\" rel=\"noopener\"><strong>pod<\/strong><\/a> is the smallest deployable unit that can be created, managed, and scaled. Pods encapsulate one or more containers, storage resources, a unique network IP, and options that govern how the containers should run. Deleting pods is a common task that might be necessary for various reasons, such as rolling updates, scaling down applications, or removing malfunctioning pods.<\/p>\n<p><em>This guide will provide an in-depth look at how to delete pods in Kubernetes using <strong>kubectl delete<\/strong> command.<\/em><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Deleting_Pods_by_Name\" >Deleting Pods by Name<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Deleting_Pods_by_Label\" >Deleting Pods by Label<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Deleting_Pods_by_Field_Selector\" >Deleting Pods by Field Selector<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Deleting_Completed_Pods\" >Deleting Completed Pods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Graceful_Deletion_of_Pods\" >Graceful Deletion of Pods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Force_Deleting_Pods\" >Force Deleting Pods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Deleting_Evicted_Pods\" >Deleting Evicted Pods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Automating_Pod_Deletion_with_CronJobs\" >Automating Pod Deletion with CronJobs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Troubleshooting_Pod_Deletion\" >Troubleshooting Pod Deletion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/linuxbuz.com\/devops\/kubectl-delete-pod\/#FAQs\" >FAQs<\/a><\/li><\/ul><\/nav><\/div>\n\n<h2><span class=\"ez-toc-section\" id=\"Deleting_Pods_by_Name\"><\/span>Deleting Pods by Name<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">The most straightforward way to delete a pod is by its name. Use the following command to delete a specific pod:<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pod pod-name<\/code><\/pre>\n<p><strong>Example:<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pod nginx-pod<\/code><\/pre>\n<p>This command will terminate the specified pod and remove it from the cluster.<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>pod \"nginx-pod\" deleted<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Deleting_Pods_by_Label\"><\/span>Deleting Pods by Label<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\"><strong>Labels<\/strong> are key\/value pairs attached to objects in Kubernetes, such as pods, which can be used to select a group of objects. You can delete multiple pods at once by specifying a <strong>label selector.<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pods -l label-key=label-value<\/code><\/pre>\n<p><strong>Example:<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pods -l app=nginx<\/code><\/pre>\n<p>This command deletes all pods with the label <strong>app=nginx.<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>pod \"nginx-pod1\" deleted\r\npod \"nginx-pod2\" deleted<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Deleting_Pods_by_Field_Selector\"><\/span>Deleting Pods by Field Selector<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\"><strong>Field selectors<\/strong> let you select Kubernetes resources based on the value of one or more resource fields. To delete pods by a field selector, use:<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pods --field-selector field-selector<\/code><\/pre>\n<p><strong>Example:<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pods --field-selector status.phase=Failed<\/code><\/pre>\n<p>This command deletes all pods that are in the <strong>Failed phase.<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>pod \"failed-pod1\" deleted\r\npod \"failed-pod2\" deleted<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Deleting_Completed_Pods\"><\/span>Deleting Completed Pods<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Pods that have completed their tasks and are in the Succeeded phase can also be deleted to free up resources.<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pods --field-selector=status.phase=Succeeded<\/code><\/pre>\n<p>This command deletes all pods that are in the Succeeded phase.<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>pod \"completed-pod1\" deleted\r\npod \"completed-pod2\" deleted<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Graceful_Deletion_of_Pods\"><\/span>Graceful Deletion of Pods<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">By default, Kubernetes gracefully shuts down pods. When a pod is deleted, it terminates, allowing it to complete ongoing operations.<\/p>\n<p>To specify a grace period before forcefully terminating a pod, use the <strong>&#8211;grace-period<\/strong> flag:<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pod pod-name --grace-period=seconds<\/code><\/pre>\n<p><strong>Example:<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pod nginx-pod --grace-period=30<\/code><\/pre>\n<p style=\"text-align: justify;\">This command gives the pod <strong>30<\/strong> seconds to shut down gracefully before being forcefully terminated.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Force_Deleting_Pods\"><\/span>Force Deleting Pods<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">In some cases, a pod might not terminate gracefully. To forcefully delete a pod, use the <strong>&#8211;force<\/strong> flag along with a grace period of 0:<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pod pod-name --grace-period=0 --force<\/code><\/pre>\n<p><strong>Example:<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pod nginx-pod --grace-period=0 --force<\/code><\/pre>\n<p>This command immediately deletes the pod without waiting for graceful termination.<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>pod \"nginx-pod\" force deleted<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Deleting_Evicted_Pods\"><\/span>Deleting Evicted Pods<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\"><strong>Evicted<\/strong> pods are pods that have been forcibly removed from a node due to resource constraints or other reasons. These pods need to be manually deleted. You can identify evicted pods using a field selector and delete them:<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pod --field-selector=status.reason=Evicted<\/code><\/pre>\n<p><strong>Example:<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl delete pod --field-selector=status.reason=Evicted<\/code><\/pre>\n<p>Output.<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>pod \"evicted-pod1\" deleted\r\npod \"evicted-pod2\" deleted<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Automating_Pod_Deletion_with_CronJobs\"><\/span>Automating Pod Deletion with CronJobs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">You can automate the deletion of pods using Kubernetes <strong>CronJobs.<\/strong> This is useful for recurring cleanup tasks.<\/p>\n<p>1. Create a CronJob manifest file <strong>delete-pods-cronjob.yaml:<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>apiVersion: batch\/v1beta1\r\nkind: CronJob\r\nmetadata:\r\n  name: delete-failed-pods\r\nspec:\r\n  schedule: \"0 *\/6 * * *\" # Runs every 6 hours\r\n  jobTemplate:\r\n    spec:\r\n      template:\r\n        spec:\r\n          containers:\r\n          - name: kubectl\r\n            image: bitnami\/kubectl\r\n            command:\r\n            - \/bin\/sh\r\n            - -c\r\n            - kubectl delete pod --field-selector=status.phase=Failed\r\n          restartPolicy: OnFailure<\/code><\/pre>\n<p>2. Apply the CronJob:<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl apply -f delete-pods-cronjob.yaml<\/code><\/pre>\n<p style=\"text-align: justify;\">This will create a CronJob that deletes failed pods every 6 hours.<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>cronjob.batch\/delete-failed-pods created<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Troubleshooting_Pod_Deletion\"><\/span>Troubleshooting Pod Deletion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you encounter issues while deleting pods, check the following:<\/p>\n<ul>\n<li><strong>Pod Status:<\/strong> Ensure the pod is not already in the process of terminating.<\/li>\n<li><strong>Pod Finalizers:<\/strong> Check if any finalizers prevent the pod from being deleted.<\/li>\n<li><strong>Kubernetes Events:<\/strong> View events related to the pod to understand why they might not be deleted.<\/li>\n<\/ul>\n<p><strong>Commands to help with troubleshooting:<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl describe pod pod-name<\/code><\/pre>\n<p><strong>Example:<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl describe pod nginx-pod<\/code><\/pre>\n<p>Output.<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>Name:         nginx-pod\r\nNamespace:    default\r\nPriority:     0\r\nNode:         minikube\/192.168.49.2\r\nStart Time:   Tue, 08 Jul 2024 12:34:56 +0000\r\nLabels:       none\r\nAnnotations:  none\r\nStatus:       Running\r\nIP:           172.17.0.4\r\n...<\/code><\/pre>\n<p style=\"text-align: justify;\">The <strong>kubectl get events<\/strong> command with the <strong>&#8211;field-selector<\/strong> option allows you to filter Kubernetes events related to a specific object, such as a pod. In this case, you want to filter events related to a\u00a0<span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\"><strong>nginx-pod pod<\/strong><\/span><strong>.<\/strong><\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto; line-height: 2.4; padding: 7px;\"><code><span style=\"color: #c4c1c0; user-select: none;\"> # <\/span>kubectl get events --field-selector involvedObject.name=nginx-pod<\/code><\/pre>\n<p>This command will list all events associated with the nginx-pod.<\/p>\n<pre style=\"background-color: #262626; color: white; border-radius: 7px; overflow: auto;\"><code>LAST SEEN   TYPE      REASON              OBJECT            MESSAGE\r\n20m         Normal    Scheduled           pod\/nginx-pod     Successfully assigned default\/nginx-pod to minikube\r\n19m         Normal    Pulling             pod\/nginx-pod     Pulling image \"nginx\"\r\n18m         Normal    Pulled              pod\/nginx-pod     Successfully pulled image \"nginx\" in 58.3154ms\r\n18m         Normal    Created             pod\/nginx-pod     Created container nginx\r\n18m         Normal    Started             pod\/nginx-pod     Started container nginx<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Deleting pods in Kubernetes is a fundamental operation that is essential for maintaining and managing your cluster. Whether you need to delete a single pod <strong>or<\/strong> a group of pods, kubectl provides versatile commands. Understanding the different methods and options available for pod deletion ensures you can handle various scenarios effectively.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"FAQs\"><\/span>FAQs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n        <section class=\"sc_fs_faq sc_card \">\n            <div>\n\t\t\t\t<h3>1. How can I safely drain pods from a Kubernetes node?<\/h3>                <div>\n\t\t\t\t\t                    <p>\n\t\t\t\t\t\tRun <strong>kubectl drain node_name --ignore-daemonsets --delete-local-data<\/strong> to safely drain a node and evict its pods.                    <\/p>\n                <\/div>\n            <\/div>\n        <\/section>\n\t\t        <section class=\"sc_fs_faq sc_card \">\n            <div>\n\t\t\t\t<h3>2. How do I cordon a Kubernetes node without draining pods?<\/h3>                <div>\n\t\t\t\t\t                    <p>\n\t\t\t\t\t\tYou can mark a node unschedulable without evicting pods using <strong>kubectl cordon node_name<\/strong> command.                    <\/p>\n                <\/div>\n            <\/div>\n        <\/section>\n\t\t        <section class=\"sc_fs_faq sc_card \">\n            <div>\n\t\t\t\t<h3>3. Can I drain a specific pod from a node instead of all pods?<\/h3>                <div>\n\t\t\t\t\t                    <p>\n\t\t\t\t\t\tNo, kubectl drain evicts all pods from the node.                    <\/p>\n                <\/div>\n            <\/div>\n        <\/section>\n\t\t        <section class=\"sc_fs_faq sc_card \">\n            <div>\n\t\t\t\t<h3>4. How do I force delete a stuck pod in Kubernetes?<\/h3>                <div>\n\t\t\t\t\t                    <p>\n\t\t\t\t\t\tYou can forcefully delete a pod using <strong>kubectl delete pod pod_name --grace-period=0 --force<\/strong> command.                    <\/p>\n                <\/div>\n            <\/div>\n        <\/section>\n\t\t        <section class=\"sc_fs_faq sc_card \">\n            <div>\n\t\t\t\t<h3>5. How do I undo a drain and allow new pods to be scheduled on a node?<\/h3>                <div>\n\t\t\t\t\t                    <p>\n\t\t\t\t\t\tYou can uncordon a node to allow new pods to be scheduled by running: <strong>kubectl uncordon node_name<\/strong>                    <\/p>\n                <\/div>\n            <\/div>\n        <\/section>\n\t\t        <section class=\"sc_fs_faq sc_card \">\n            <div>\n\t\t\t\t<h3>6. What\u2019s the difference between kubectl delete pod and kubectl drain?<\/h3>                <div>\n\t\t\t\t\t                    <p>\n\t\t\t\t\t\t<strong>kubectl delete pod<\/strong> removes a specific pod, while <strong>kubectl drain<\/strong> evicts all pods from a node and marks the node as unschedulable.                    <\/p>\n                <\/div>\n            <\/div>\n        <\/section>\n\t\t\n<script type=\"application\/ld+json\">\n    {\n\t\t\"@context\": \"https:\/\/schema.org\",\n\t\t\"@type\": \"FAQPage\",\n\t\t\"mainEntity\": [\n\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"1. How can I safely drain pods from a Kubernetes node?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"Run <strong>kubectl drain node_name --ignore-daemonsets --delete-local-data<\/strong> to safely drain a node and evict its pods.\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"2. How do I cordon a Kubernetes node without draining pods?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"You can mark a node unschedulable without evicting pods using <strong>kubectl cordon node_name<\/strong> command.\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"3. Can I drain a specific pod from a node instead of all pods?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"No, kubectl drain evicts all pods from the node.\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"4. How do I force delete a stuck pod in Kubernetes?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"You can forcefully delete a pod using <strong>kubectl delete pod pod_name --grace-period=0 --force<\/strong> command.\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"5. How do I undo a drain and allow new pods to be scheduled on a node?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"You can uncordon a node to allow new pods to be scheduled by running: <strong>kubectl uncordon node_name<\/strong>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"6. What\u2019s the difference between kubectl delete pod and kubectl drain?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<strong>kubectl delete pod<\/strong> removes a specific pod, while <strong>kubectl drain<\/strong> evicts all pods from a node and marks the node as unschedulable.\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t\t    ]\n}\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>In Kubernetes, a pod is the smallest deployable unit that can be created, managed, and scaled. Pods encapsulate one or more containers, storage resources, a unique network IP, and options &hellip; <\/p>\n","protected":false},"author":1,"featured_media":5310,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"two_page_speed":[],"footnotes":""},"categories":[828],"tags":[830],"class_list":["post-5309","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-kubernetes"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/posts\/5309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/comments?post=5309"}],"version-history":[{"count":0,"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/posts\/5309\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/media\/5310"}],"wp:attachment":[{"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/media?parent=5309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/categories?post=5309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxbuz.com\/wp-json\/wp\/v2\/tags?post=5309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}