How to Automatically Detach EBS PVCs During Node Drain in EKS?

0
0
Asked By CloudDancer42 On

Hey folks, I'm having an issue with my EKS nodes while trying to perform a patch. I have a deployment that's using an EBS-backed PVC, and when I run `kubectl drain`, the associated pod is scheduled to a new node but ends up in a "Pending" state. It turns out the PVC is still attached to the old node.

I want to find out how to resolve this. Every time I drain a node, I don't want to have to manually detach and reattach the PVC. Ideally, the PVC should automatically detach from the older node and reattach to the new one during the drain process. Any advice on how to make this work?

3 Answers

Answered By DataNinja88 On

You might want to rethink your deployment strategy. If you’re using a single replica with an EBS PV in a deployment, consider using a StatefulSet instead. StatefulSets handle storage more elegantly and can help avoid conflicts when nodes are drained.

Answered By TechGuru99 On

It looks like the issue stems from your PVC being tied to a specific availability zone. To fix this, consider allowing volume creation across all zones where your pods can be scheduled. This way, during a drain, if a pod needs to move, the PVC will be available in the correct zone without conflicts. Is there a reason you set it up that way initially?

Answered By CloudExplorer22 On

Just a side note, have you considered using us-west-2 instead? It's often cheaper and has more availability zones, which might prevent similar issues in the future.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.