elotl / kip

Virtual-kubelet provider running pods in cloud instances
Apache License 2.0
223 stars 14 forks source link

Creating GCE external load balancer fails #106

Open ldx opened 4 years ago

ldx commented 4 years ago

The GCE cloud provider in k8s does not like the fact that there's no cloud instance called virtual-kubelet:

default 3s Normal EnsuringLoadBalancer service/nginx Ensuring load balancer default 3s Warning CreatingLoadBalancerFailed service/nginx Error creating load balancer (will retry): failed to ensure load balancer for service default/nginx: instance not found

Whether we use host network mode or not does not matter though. It's hard-coded in the GCE cloud plugin to list all nodes and bail if any of them is not a GCE VM instance: https://github.com/kubernetes/legacy-cloud-providers/blob/master/gce/gce_loadbalancer_external.go#L59-L62

ldx commented 4 years ago

Adding the alpha.service-controller.kubernetes.io/exclude-balancer or node.kubernetes.io/exclude-from-external-load-balancers label to the virtual-kubelet node excludes it from LBs. However, this needs the ServiceNodeExclusion feature gate, which is still alpha in Kubernetes: https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/

Creating an alpha cluster in GKE will enable the feature gate, however, alpha clusters are not supported for production workloads: https://cloud.google.com/kubernetes-engine/docs/concepts/alpha-clusters

ldx commented 4 years ago

ServiceNodeExclusion will graduate to beta and will be on by default in 1.19: https://github.com/kubernetes/kubernetes/commit/2369ef090e4f493a8c960c4107bd18f308d37aa2

ldx commented 4 years ago

Adding the alpha.service-controller.kubernetes.io/exclude-balancer label will make gce-ingress work (not with container-native load balancing, though).