hcloud-cloud-controller-manager icon indicating copy to clipboard operation
hcloud-cloud-controller-manager copied to clipboard

Load Balancer on ingress goes to unused servers

Open jaumecornado opened this issue 5 years ago • 12 comments

I have a 7 node kubernetes cluster with nginx-ingress.

Captura de Pantalla 2021-03-24 a les 11 39 41

If ingress is not deployed on all nodes; Load Balancer goes to mixed health. Can we go on green?

jaumecornado avatar Mar 24 '21 10:03 jaumecornado

same here. IMHO LB should not get targets for nodes which are not workers...

blafasel42 avatar Apr 23 '21 08:04 blafasel42

Or as an alternative LB can remove the target if it is unhealthy for some period. So your target will be removed from LB

sergeyshevch avatar May 01 '21 05:05 sergeyshevch

You can manually exclude nodes from the LB until (if ever) this is automated: https://github.com/hetznercloud/hcloud-cloud-controller-manager/issues/182#issuecomment-830577642

Shadowghost avatar May 01 '21 08:05 Shadowghost

Just ran into this issue where we have 25+ nodes in a cluster (breaking the Hetzner load balancer limit) and the Service was pointing to all nodes even though some nodes can't even run the LoadBalancer'd application. Would be very nice to dynamically update the LoadBalancer based on whether or not a node has a Pod that is running the LoadBalancer'd application.

RyanSquared avatar Jun 25 '21 14:06 RyanSquared

@RyanSquared i guess you can exclude this node with annotations from previous comment

sergeyshevch avatar Jun 26 '21 13:06 sergeyshevch

@RyanSquared i guess you can exclude this node with annotations from previous comment

We have 23 nodes that we're considering "general purpose"/"untainted", and at some point I think we're gonna have to dedicate some nodes specifically for load balancer services and have every node labeled as excluded.

RyanSquared avatar Jun 26 '21 23:06 RyanSquared

This is how Kubernetes handles it right now.

Since Kubernetes 1.21 the ServiceNodeExclusion FeatureGate is enabled by default, so you should only need to add the correct annotation to your nodes if you're on Kubernetes 1.21+

Shadowghost avatar Jul 09 '21 13:07 Shadowghost

can you give us a hint, which annotation exactly, @Shadowghost?

blafasel42 avatar Jul 09 '21 13:07 blafasel42

The one I mentioned here: https://github.com/hetznercloud/hcloud-cloud-controller-manager/issues/182#issuecomment-830577642 node.kubernetes.io/exclude-from-external-load-balancers: "true"

Shadowghost avatar Jul 09 '21 14:07 Shadowghost

ah, so I annotate nodes. makes sense since controller nodes will be quite static. Thanks for the insight!

blafasel42 avatar Jul 09 '21 14:07 blafasel42

I will close the issue here, as the Cloud Controller Manager is not in charge of "selecting" the nodes. @Shadowghost already posted the k8s solution to exclude the nodes: https://github.com/hetznercloud/hcloud-cloud-controller-manager/issues/182#issuecomment-830577642

LKaemmerling avatar Aug 25 '21 06:08 LKaemmerling

CCM has support for this annotation as mentioned here

"load-balancer.hetzner.cloud/node-selector"

https://pkg.go.dev/github.com/hetznercloud/hcloud-cloud-controller-manager/internal/annotation#Name

easystartup-io avatar Dec 25 '23 15:12 easystartup-io