Longhorn: [Question] How to transfer volumes to another node?

Created on 15 Jun 2020  路  3Comments  路  Source: longhorn/longhorn

If I want to remove a node in kubernetes, how can I transfer the volume to another node?

Example:
I have three node (Node 1, Node 2, Node 3). Node 3 holds the data of a volume with 50Gi.
Now I want to remove Node 3 from the cluster. How can I transfer the volume (data) to on of the remaining nodes.

kubectl drain <node-id> seems to only remove the pods on that node.

question

All 3 comments

@JLueke for 1.0 the default settings create 3 replicas for a volume, with hard anti affinity. So each replica would end up on it's own node. In that case the data should be available on one of the other replicas. In the case where you only have a single replica, the best approach would probably be a backup & restore. cc @shuo-wu to get his input on this.

As Joshua said, there are 3 replicas for each volume by default. Hence removing a node typically won't corrupt the volume.

For safety or for the case that there is a single replica for the volume, you can check whether there is at least one replica on the nodes that won't be removed later via UI.
If YES, it's fine to remove the node.
If NO, you can:

  1. disable the scheduling for the node that will be removed later.
  2. increase the replica count to trigger replica rebuild on new nodes.
  3. decrease the replica count
    Then you can remove the node without affecting the volume.

Of course, backup & restore is also a good choice.

Thank you.

Was this page helpful?
0 / 5 - 0 ratings