Volume and Pod affinity #8101
Replies: 3 comments 4 replies
-
The pod should run on the volume attached node. Can you see why the pod isn't running on the node where the volume is attached in your setup from longhron-manager logs? |
Beta Was this translation helpful? Give feedback.
-
Is the volume already attached? |
Beta Was this translation helpful? Give feedback.
-
@derekbit i can confirm that i was able to reproduce the issue by having the following situation: pod 1 was running on node A while using volume V mounted on that same node. the cluster has 3 nodes and the volume V is replicated on node B. now the node A was manually rebooted and the pod 1 was moved by k8s on node B. However from the longhorn UI i can see that volume V was still attached to node A, so the pod 1 got stucked on pending forever ... even after force deleting the pod 1 manually, k8s was still rescheduling it on node B and so it was never able to attach the volume ... the only way i have found to start the pod was to manually detach the volume V from node A and attach it to node B using the GUI ... can this be avoided ? btw i have dumped the logs of both longhorn-managers on both nodes and i am going to remove some sensitive info and post them here if needed |
Beta Was this translation helpful? Give feedback.
-
i have a scenario with 3 nodes and 1 volume. this one volume has 2 replicas with least-effort auto balancing. this ensures that the 2 replicas will live on different nodes, thus reaching an HA situation.
Now i am stuck with the issue whereby a Pod which needs to access the longhorn volume (via a PVC) spawns on the single node which has no volume replica on it ... this pod gets stuck in Pending state because it cannot attach the volume on its node.
how can i prevent such kind of situations?
please note that using node affinity is not a valid solution, since i cannot know in advance which nodes are being selected by longhorn as host for the 2 replicas.
is it possible to use some kind of affinity rule to avoid this scenarios ? i have tried with data locality "strict-local" but this makes me lose the HA property of the volume, which is indeed a must have
Beta Was this translation helpful? Give feedback.
All reactions