How to Configure Longhorn for Specific Node Usage?
Asked by
envelope flap
I'm currently working with Longhorn and have a few requirements I need help with. I want to limit storage writes to only three specific nodes that have available disks. Additionally, I need to ensure that all nodes in my cluster can access Longhorn storage. I'm planning to deploy everything using Helm and would like to make adjustments through a config.yaml file. I've already set up labels and taints on my nodes, but it seems like Longhorn isn't cooperating with my setup. If anyone has experience with this and can provide a sample config.yaml or other insights, I'd really appreciate it!
Answers
I stick with the official Longhorn Helm chart for deployment. Hereโs a snippet of the values I use:
```yaml
defaultSettings:
defaultDataPath: "/opt/longhorn/"
createDefaultDiskLabeledNodes: true
ingress:
enabled: true
ingressClassName: kong
host: ""
tls: false
path: /longhorn/
pathType: Prefix
annotations:
konghq.com/strip-path: "true"
persistence:
defaultClassReplicaCount: 1
```
Donโt forget to label the nodes you want Longhorn to use for disks like this: `kubectl label nodes node_name node.longhorn.io/create-default-disk=true`. This setup has worked really well for me!
Reply to this answer
For labeling nodes, you can either use the Longhorn CLI or the UI. After labeling, ensure to set node affinity on your storage class to match the specified labels. Iโll provide more updates once Iโm awake and can dive deeper into this!
Reply to this answer
From my experience, the Longhorn documentation is pretty spot-on. I found that enabling the "Create Default Disk on Labeled Nodes" option did the trick for me. On the nodes where I wanted the disks, I applied this label: `node.longhorn.io/create-default-disk=true`. This way, Longhorn only sets up storage on the labeled nodes, but I could still utilize Longhorn storage classes across all nodes. You can check out the official guide for more info: [Longhorn Documentation](https://github.com/longhorn/longhorn/blob/master/enhancements/20200319-default-disks-and-node-configuration.md).
!18 envelopes sealed: Thanks for the tip! I'm struggling with Longhorn placing resources on my control nodes. Do you have any recommendations on how to prevent that? Maybe taints on the control nodes?
Reply to this answer
Add your answer
Answers are reviewed before publication.
+bakers peel!: Thanks for sharing! Do you have advice on avoiding deployments on control nodes? Should I apply taints to those?