Closed ktalap closed 3 weeks ago
Okay so the problem was that I accidentally run the kubespray setup script on the worker node, it then set the following label on it preventing loabalancer from attaching:
node.kubernetes.io/exclude-from-external-load-balancers=
root@control-plane:~# kubectl get node node1 --show-labels
NAME STATUS ROLES AGE VERSION LABELS
node1 Ready control-plane 14h v1.31.2 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/instance-type=cx22,beta.kubernetes.io/os=linux,failure-domain.beta.kubernetes.io/region=hel1,failure-domain.beta.kubernetes.io/zone=hel1-dc2,kubernetes.io/arch=amd64,kubernetes.io/hostname=node1,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=,node.kubernetes.io/instance-type=cx22,topology.kubernetes.io/region=hel1,topology.kubernetes.io/zone=hel1-dc2
root@control-plane:~#
This label explicitly tells Kubernetes to exclude this node from load balancers. Just remove it:
kubectl label node node1 node.kubernetes.io/exclude-from-external-load-balancers-
# Verify it's removed
kubectl get node node1 --show-labels
TL;DR
It all works good if I add the target to my node manually in hetzner. Otherwise, all the ports and everything are set but the target to the node. Here is the logs of the controller:
I1027 15:16:52.858565 1 event.go:307] "Event occurred" object="default/web-app" fieldPath="" kind="Service" apiVersion="v1" type="Normal" reason="EnsuringLoadBalancer" message="Ensuring load balancer" I1027 15:16:52.878447 1 load_balancers.go:109] "ensure Load Balancer" op="hcloud/loadBalancers.EnsureLoadBalancer" service="web-app" nodes=[] I1027 15:16:52.879167 1 event.go:307] "Event occurred" object="default/web-app" fieldPath="" kind="Service" apiVersion="v1" type="Warning" reason="UnAvailableLoadBalancer" message="There are no available nodes for LoadBalancer" I1027 15:16:53.741870 1 route_controller.go:216] action for Node "node1" with CIDR "10.233.64.0/24": "keep" I1027 15:16:55.376856 1 load_balancer.go:723] "add service" op="hcops/LoadBalancerOps.ReconcileHCLBServices" port=80 loadBalancerID=2127367 I1027 15:16:56.411260 1 load_balancers.go:159] "reload HC Load Balancer" op="hcloud/loadBalancers.EnsureLoadBalancer" loadBalancerID=2127367 I1027 15:16:56.589854 1 event.go:307] "Event occurred" object="default/web-app" fieldPath="" kind="Service" apiVersion="v1" type="Normal" reason="EnsuredLoadBalancer" message="Ensured load balancer"
Doesn't look like it's failing or anything. Here is the cluster config for the kubespray:
Expected behavior
Supposed to add the internal target to the node that is running the pod.
Observed behavior
Doesn't add anything to the targets.
Minimal working example
No response
Log output
No response
Additional information
No response