Kubernetes cloud provider

11/29/2019

I'm new to Kubernetes and their is a concept I'm not sure to fully understand: Cloud Providers.

  • I have installed my Kubernetes cluster using RKE (Rancher engine).
  • My cluster is set on top of rancher2.
  • My nodes are Virtual Machines hosted an OVH server.

I manage to have running applications with L7 ingresses and ClusterIP services but everytime I try to have a L4 LoadBalancer, the LoadBalancer is stuck in pending state. According to https://github.com/rancher/rancher/issues/14424 this is because I doesn't have any CloudProvider.

But what is exactly the purpose of a CloudProvider? Isn't it to run Kubernetes nodes, pods, ... on the cloud? If yes, why should I bother getting a CloudProvider if my applications are pods are already on the cloud and accessible from the outside thanks to my configuration.

So my following questions are:

  • What is exactly the role of a CloudProvider?
  • Is it useful in my environment ?
  • Is it mandatory to have a CloudProvider in order to run L4 Load Balancer ?
  • What is the alternative to a L4 LoadBalancer ?
  • Can't I have custom CloudProvider not relying on one of those listed here: https://kubernetes.io/docs/concepts/cluster-administration/cloud-providers/ ? Like a self-hosted CloudProvider running NGINX or something ?

Thanks for any clarification/recommandation on this subject. -

-- MHogge
kubernetes

1 Answer

11/29/2019

In case of Rancher

An external cloud provider is a kubernetes controller that runs cloud provider-specific loops required for the functioning of kubernetes. These loops were originally a part of the kube-controller-manager, but they were tightly coupling the kube-controller-manager to cloud-provider specific code. In order to free the kubernetes project of this dependency, the cloud-controller-manager was introduced.

This brings us to the topic of Kubernetes Cloud Controller Manager

Kubernetes v1.6 introduced a new binary called cloud-controller-manager. cloud-controller-manager is a daemon that embeds cloud-specific control loops. These cloud-specific control loops were originally in the kube-controller-manager. Since cloud providers develop and release at a different pace compared to the Kubernetes project, abstracting the provider-specific code to the cloud-controller-manager binary allows cloud vendors to evolve independently from the core Kubernetes code.

Regarding the LoadBalancer part:

  • There is a guide showing how to create an External Load Balancer. It says:

You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster.

  • If you need an alternative however, you may want to use Ingress

An API object that manages external access to the services in a cluster, typically HTTP. Ingress can provide load balancing, SSL termination and name-based virtual hosting.

If you want to get a better idea of this concept than check out this SO thread.

And lastly regarding the custom Cloud Provider. It is possible to enable a different cloud provider for RKE:

If you want to enable a different cloud provider, RKE allows for custom cloud provider options. A name must be provided and the custom Cloud Provider options can be passed in as a multiline string in customCloudProvider.

I hope it helps.

-- OhHiMark
Source: StackOverflow