Understanding Longhorn and Pod Affinity Issues in Kubernetes

0
7
Asked By CuriousCoder88 On

I might be missing something about how Longhorn operates in my Kubernetes setup, and I could use some clarification. I've set up three "storage" nodes for managing my Longhorn replicas, and everything's been working fine so far. I also have separate worker nodes, including one dedicated to a large language model (LLM).

When I create a test pod without any affinity rules, it successfully picks a worker node and creates a persistent volume claim (PVC) with Longhorn handling it seamlessly. However, when I add affinity rules (like directing a specific pod to the worker nodes), the pod gets stuck in a "pending" state with an error indicating that none of the nodes are suitable.

I realize that I could let every node use Longhorn, but that would mean more replicas than I want, significantly increasing storage costs since I only need three replicas. Here's a snippet of the YAML I'm using for applying the PVC and pod creation. When I remove the affinity rules, it works just fine, so I'm puzzled about why it's not functioning with them in place.

3 Answers

Answered By NodeNerd42 On

Have you made sure your worker nodes are correctly labeled? If they're not, the affinity rules might not match properly, leading to the errors you're seeing. Double-check those labels to ensure everything aligns with your affinity configurations.

Answered By TechSavvySam On

Just to clarify, Longhorn daemons should be running on all nodes, including the workers. If you're disabling PVC scheduling on the workers, make sure that your affinity rules align with that setup. You might find that without node affinity, it creates the PVC on your designated storage nodes, which is why it works then.

Answered By StorageGuru123 On

It sounds like your Longhorn PVC is tied to the storage nodes, which aren't labeled as workers. Longhorn needs to run on any node that will use its volumes, but you can control where the actual data lives based on which nodes have disks matching the Longhorn volume tags. Check if your affinity rules are set correctly because it might be causing scheduling issues on your setup.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.