When we create a service type loadbalancer, how does kubernetes know to talk to the cloud provider and create a load balancer.. For example if my cloud provider is Azure and I have my cluster running on a bunch of VMs on Azure.. how do I provide access to my kubernetes cluster to go and provision a load balancer in Azure and expose my service through an external IP
It’s a little while since I’ve done anything serious with a DIY cloud cluster (not EKS, GKE, AKS etc). But normally you’d build your K8s cluster and tell it that it’s on XYZ cloud as part of the cluster initialization. This tells your K8s cluster that it’s on a particular cloud platform and you get a cloud controller running on the K8s control plane. This all does the necessary to make sure K8s knows which cloud you’re on and have access to create relevant cloud objects etc.
@Asad Alim it is a configuration flag, e.g. "–cloud-provider=aws command-line flag" should be present for the API server, controller manager, and every Kubelet in the cluster. for more info refer to Scott Lowe blog https://blog.scottlowe.org/2018/09/28/setting-up-the-kubernetes-aws-cloud-provider/
Now that kubeadm is GA, here is how you do it with Kubeadm https://kubernetes.io/docs/concepts/cluster-administration: cloud providers