Hi!
I have a question concerning running Longhorn in GKE.
I already know that I cannot use the Google “Container Optimized OS” but need to run Ubuntu for Longhorn.
In my cluster, I have both Ubuntu and Container Optimized OS nodes and I used affinities to control which pods are scheduled on which node.
Can I use Longhorn in such an environment? Can I set the node affinity somewhere? If it works, is it correct that only the Ubuntu Nodes will be able to mount volumes managed by Longhorn?
Taint and tolerations means that the node will only accept workload from certain pods.
Tolerations is on the pod and says that it will accept being put on a node but not being explicit.
For example lets say I have 5 nodes.
ServerA
ServerB
ServerC
ServerD
ServerE
If I have a taint on ServerA and ServerB with something like storage=true:NoExecute ; storage=true:Noschedule. So as we expect this will not allow any pods to go on without having the toleration of storage=true:NoExecute ; storage=true:Noschedule.
So on the deployment we put on a toleration of:
storage=true:NoExecute
storage=true:Noschedule
what this means is that when the pod is scheduled it WILL be accepted on ServerA and ServerB but it would will ALSO be accepted on ServerC,D,E if they happen to get scheduled on there.
To control where the pod gets ‘attracted’ to you have to use node affinity and this is something I can’t find on LongHorn
@weiyentan
I see your use case! Thank you for the clarification.
Yeah, you are right. In order to solve this problem, Longhorn needs to allow users to specify node selector or node affinity so that Longhorn components only get deployed onto a specific group of nodes. We opt to go with node selector because it is simple and get the job done.
Another use case for this feature is that users have a cluster of both Linux nodes and Windows nodes. Users want to install Longhorn only on Linux nodes because Longhorn doesn’t work on Windows nodes.