serviceExternalIPS (LoadBalancer type) and IP allocation

Hello!

I’m new to kubernetes and managed to set up a small cluster using Calico as the networking component.

I’m trying out some examples using a LoadBalancer Service. I’m trying to understand how kubernetes together with Calico is allocating the IP-address when creating the resource.

I read that you should use the serviceExternalIPs to put the CIDRs you want to be announced using BGP.

But I don’t find any information in the documentation what CIDRs is used when creating a LoadBalancer. It does get an IP but not the one from serviceExternalIPs CIDRS. Does Calico support allocating IPs for services? Or do I have to do a manual setup of the external IP when creating the LoadBalancer?

Calico only allocates pod IPs, services can have more than one IP:

  • The ClusterIP is allocated by the kube-controller-manager from its own pool.
  • Load balancer IPs are allocated by your cloud provider. For example, if you’re in AWS, you can turn on the AWS cloud provider, which will use the AWS API to create a load balancer and then fill in the IP in the service.

The external IP advertisement feature allows you to advertise the external IP of a service form the cluster but it doesn’t actually allocate external IPs for you. To use the feature, you don’t need a cloud provider (since that creates a real external IP and there’s no need for Calico to advertise it). Instead, you can just fill in the external IP manually or using whatever script you like and Calico will advertise it.

Would be a more well-rounded feature if Calico could allocate the IP for you but the feature was a community contribution that didn’t include that part.

It sure would be nice if it could’ve allocated the IPs but manually adding a external IP to the LoadBalancer resource isn’t that hard. Lets hope it’s a feature that will be available in a future release.

Thanks for the help.