Project and VPC of Load Balancer Created by Cloud Controller Manager

Posted October 12, 2020 599 views
TerraformDigitalOcean Managed KubernetesDigitalOcean Managed Load Balancers

When a load balancer is created by the cloud controller manager, it takes on same region as the kubernetes cluster. Wouldn’t it make sense to have it also be set to the same project and vpc as the cluster?

Some context: I am using the Helm provider of Terraform to install ingress-nginx on my kubernetes cluster. I would like to make the load balancer that is created to be part of the same project and vpc that the cluster is part of. Since I am using Terraform to provision, manual interaction is not an option.

I have taken a look at the do-ccm project. As far as I’m understanding, there is no way for me to force a loadbalancer service to be part of a given project or vpc. When I take a look at the do-ccm getting started guide, I do see a paragraph about using a custom vpc by setting an environment variable. However, it seems like this needs to be set up when creating the cluster. I’m using doks, so I’m not the one creating the cluster. To be clear, the cluster that i provision with Terraform is part of a custom vpc. Furthermore, the available loadbalancer annotations don’t cover the project or vpc (unlike the loadbalancer name, for example). The ingress-nginx documentation doesn’t help me, nor does googling for something related.

Maybe I’m just not getting it. Is there some way for me to set the project and vpc of the loadbalancer?

1 comment
  • Even I’m have the same difficulties.
    I have followed the docs and deployed DO CCM and trying to create service type as LoadBalancer but seeing error as :

    Warning SyncLoadBalancerFailed 4m9s (x3 over 14m) service-controller (combined from similar events): Error syncing load balancer: failed to ensure load balancer: failed to create load-balancer: POST 422 (request “4e5c0f90-0dc4-4be6-8fc7-aaf4eb6dea30”) some of the specified target droplets don’t belong to the same VPC as the Load Balancer

    unable to locate instruction where do we have to configure DOCLUSTERVPC_ID

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

DigitalOcean cloud controller manager runs service controller, which is responsible for watching services of type LoadBalancer and creating DO loadbalancers to satify its requirements. Here are some examples of how it’s used.