Search code examples
amazon-web-serviceskuberneteskubernetes-helmamazon-eks

Attach PersistentVolume in a new node in Kubernetes


I try to describe my scenario:

I have a MariaDB from bitnami installed in an EKS Kubernetes cluster.
I'm deploying my database using helm with the following command

helm install mariadb bitnami/mariadb \
     --set primary.persistence.enabled=true \
     --set primary.persistence.size=1Gi
  • This command creates a PVC in my environment.
  • The problem comes when every night I destroy the node in order to save money.
  • I reduce the ASG to 0 and then the node is destroyed.
  • Every morning I extend de ASG to 1, and then a new node is created, my MariaDB is deployed but doesn't attach the PVC.

Is there any way to get the volume could attach again to a new node every day?

Thanks

SOLUTION

The problem was the AZ where my node and the volumen were created in every recreation, because I'm using multi-AZ. In my case, as is development environment, I forced to use just one AZ and the problem is fixed.


Solution

  • You don't get back the volume because the node you launched every morning is not guaranteed to be in the same AZ as yesterday; which the volume was last created. Switch to single AZ will work for you as you only need to launch one node everyday. On the console goto the ASG and edit the Network -> Availability Zones.