# Draining a node does not evict pods

**URL:** <https://forums.suse.com/t/draining-a-node-does-not-evict-pods/14571>\
**Category:** SUSE Rancher Prime\
**Created:** [June 19, 2019, 8:20am UTC](https://forums.suse.com/t/draining-a-node-does-not-evict-pods/14571 "2019-06-19T08:20:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![boristimp](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/boristimp/32/5331_2.png) [@boristimp](https://forums.suse.com/u/boristimp)\
**Post date:** [June 19, 2019, 8:20am UTC](https://forums.suse.com/t/draining-a-node-does-not-evict-pods/14571/1 "2019-06-19T08:20:31Z")

</div>

The documentation states the following behaviour for draining nodes: “Marks the node as unschedulable _and_ evicts all pods.”

Draining a node on my cluster (mode: safe) marks the node as unschedulable but does _not_ remove pods from the node or reschedules pods on other nodes. When draining the node I set the grace period for terminating pods manually to 5 secs.

Are there any further default timeout settings in the cluster, before evicting happens and where/how to tweak them?

Setup: 3 worker nodes, 1 etcd node (do)  
Rancher version v2.2.4  
Pod: bare nginx

---

<div class="post-metadata">

**Author:** ![shubbard343](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@shubbard343](https://forums.suse.com/u/shubbard343)\
**Post date:** [June 19, 2019, 8:20pm UTC](https://forums.suse.com/t/draining-a-node-does-not-evict-pods/14571/2 "2019-06-19T20:20:01Z")

</div>

Which pods are not being re-scheduled? From your description, you have `Pod: bare nginx`. Is that a standalone Pod, and not a deployment/daemonset, etc?

From the Drain page:

```auto
Permanently delete:

    Standalone Pods and their data
    Pods with "Empty Dir" volumes and their data.

```

I found that the only way to ensure that pods are rescheduled is to use the Aggressive mode, and I have drained nodes many times that way.

Have you tried the Aggressive mode?

---

<div class="post-metadata">

**Author:** ![boristimp](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/boristimp/32/5331_2.png) [@boristimp](https://forums.suse.com/u/boristimp)\
**Post date:** [June 21, 2019, 9:53am UTC](https://forums.suse.com/t/draining-a-node-does-not-evict-pods/14571/3 "2019-06-21T09:53:34Z")

</div>

Yes, I used a standalone pod.  
I found out that the pod was actually rescheduled to an available worker, so actually rescheduling is working. The point which let me intitiallly think that the pod lives still on the drained node was that the endpoint was not updated, still having the IP of the drained node. I did not set up an ingress, nor any dns related stuff, just made a quick installation and played a little bit with it.

From my point of view, any endpoints directing to a drained node should at least be labeled as unavailable or even change the IP along with the moved/rescheduled pod.

---

<div class="post-metadata">

**Author:** ![shubbard343](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@shubbard343](https://forums.suse.com/u/shubbard343)\
**Post date:** [June 21, 2019, 7:48pm UTC](https://forums.suse.com/t/draining-a-node-does-not-evict-pods/14571/4 "2019-06-21T19:48:08Z")

</div>

> I did not set up an ingress

Yes, for a true test, try setting up a Deployment with an Ingress, and you should get much better success.
