# How to safely do k8s node maintenance

**URL:** <https://discuss.elastic.co/t/how-to-safely-do-k8s-node-maintenance/230292>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [April 29, 2020, 3:11am UTC](https://discuss.elastic.co/t/how-to-safely-do-k8s-node-maintenance/230292 "2020-04-29T03:11:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FingerLiu](https://avatars.discourse-cdn.com/v4/letter/f/f19dbf/32.png) [@FingerLiu](https://discuss.elastic.co/u/FingerLiu)\
**Post date:** [April 29, 2020, 3:11am UTC](https://discuss.elastic.co/t/how-to-safely-do-k8s-node-maintenance/230292/1 "2020-04-29T03:11:12Z")

</div>

In case we want to delete one k8s node, what should we do to safely delete/replace ES nodes on that k8s node.

We are on bare metal cluster, and using local disk as storage class.

From what I try, the following manual seems work. Is this the right way?

1. cordon node
2. delete pvc on this node
3. drain node

Is this something that ECK operator should cover?

---

<div class="post-metadata">

**Author:** ![sebgl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebgl/32/48702_2.png) [@sebgl](https://discuss.elastic.co/u/sebgl)\
**Post date:** [April 30, 2020, 11:53am UTC](https://discuss.elastic.co/t/how-to-safely-do-k8s-node-maintenance/230292/2 "2020-04-30T11:53:57Z")

</div>

Your approach seems correct. Does it work well for you?

I think the cordon/drain phase feels out of scope for being handled by ECK.

We have [an issue open in Github](https://github.com/elastic/cloud-on-k8s/issues/2806) to facilitate this process: ECK could potentially take care of the ES Pod +PVC deletion, after safely migrating the data away.

---

<div class="post-metadata">

**Author:** ![FingerLiu](https://avatars.discourse-cdn.com/v4/letter/f/f19dbf/32.png) [@FingerLiu](https://discuss.elastic.co/u/FingerLiu)\
**Post date:** [May 6, 2020, 9:22am UTC](https://discuss.elastic.co/t/how-to-safely-do-k8s-node-maintenance/230292/3 "2020-05-06T09:22:51Z")

</div>

this seems work, but do not recommand do it in prod.

```
kubectl cordon k8s-node-abc

kubectl delete pvc -es-xxx --force --grace-period=0

kubectl drain k8s-node-abc --delete-local-data --ignore-daemonsets

kubectl uncordon k8s-node-abc
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 7:56am UTC](https://discuss.elastic.co/t/how-to-safely-do-k8s-node-maintenance/230292/4 "2022-11-04T07:56:02Z")

</div>


