In the realm of Kubernetes, the Cloud Controller Manager (CCM) serves as a pivotal component of Control Plane. It enables seamless integration between Kubernetes clusters and various cloud providers. Understanding its architecture, internal workings, and practical usage scenarios is essential for efficiently managing cloud resources within Kubernetes environments. In this comprehensive guide, we’ll delve into the intricacies of the Cloud Controller Manager. Will explore it’s architecture, and how it works in various Cloud Platforms like Azure, Google Cloud Platform (GCP), and Amazon Web Services (AWS).

Cloud infrastructure technologies let you run Kubernetes on public, private, and hybrid clouds. Kubernetes believes in automated, API-driven infrastructure without tight coupling between components. The cloud-controller-manager component in Kubernetes separates the interaction logic between Kubernetes and the underlying cloud infrastructure. This separation allows cloud providers to roll out new features on their own timeline, independent of the main Kubernetes project’s release cycle.

When using a Cloud managed Kubernetes cluster like Google Kubernetes Engine (GKE) or AWS Elastic Kubernetes Services (EKS ), the cloud provider takes care of configuring the CCM. So you don’t need to perform any extra configurations to make the cluster work seemlessly with the various Cloud Services. The real challenges come, when you are setting up a Self-Managed Kubernetes Cluster. Your custom K8s cluster would not know how to talk to the Cloud Infra and provision the required Services from the Kubernetes directly. This is where the knowledge of

What is Cloud Controller Manager in Kubernetes?

The Cloud Controller Manager (CCM) is a crucial component of Kubernetes responsible for managing cloud-specific resources and functionalities within a cluster. It abstracts away cloud-provider-specific operations from the core Kubernetes control plane components, ensuring seamless integration and consistent management of cloud resources across different environments. For example, your Kubernetes Pod needs a loadBalancer with a pulic IP so that you can access your service/pods from outside world with this IP. So, CCM will work with the cloud platform for the provision of a LoadBalancer and assign a public IP to it.

Architecture of CCM works internally?

The Cloud Controller Manager follows a modular architecture, consisting of cloud-provider-specific controllers responsible for interacting with the respective cloud provider’s APIs to manage resources. It has 3 main components:

  1. Cloud Provider Controllers: Each cloud provider has its set of controllers responsible for managing cloud-specific resources such as virtual machines, load balancers, and storage volumes.
  2. Controller Manager: The Controller Manager is the central component responsible for orchestrating the operation of various cloud provider controllers. It interacts with the Kubernetes API server to receive instructions and manages the lifecycle of cloud resources.
  3. Cloud Provider Interface (CPI): The Cloud Provider Interface acts as a bridge between the Kubernetes control plane and cloud provider-specific APIs. It abstracts cloud provider details, allowing controllers to interact with different cloud providers using a unified interface.

The controllers inside the CCM include, 3 controllers: Node Controller, Route Controller and Service Controller.

1. Node Controller:

  • The Node Controller is a core component of the Kubernetes control plane responsible for managing the lifecycle of nodes within the cluster.
  • It monitors the state of nodes, including their availability, capacity, and health status.
  • The Node Controller ensures that the desired number of nodes specified by the user or configured auto-scaling policies are maintained in the cluster.
  • It handles tasks such as node registration, eviction, and node-level operations like scheduling pods onto nodes based on resource availability and constraints.

2. Route Controller:

  • The Route Controller is typically associated with platforms that support routing external traffic to services within the Kubernetes cluster, such as OpenShift.
  • In OpenShift, the Route Controller manages the creation, configuration, and lifecycle of routes, which are used to expose services to external clients.
  • Routes define rules for directing incoming traffic to the appropriate service endpoints within the cluster, enabling external access to applications deployed on Kubernetes.
  • The Route Controller ensures that routes are created, updated, and deleted based on changes to the cluster’s configuration or user-defined specifications.

3. Node Controller:

  • The Node Controller is a core component of the Kubernetes control plane responsible for managing the lifecycle of nodes within the cluster.
  • It monitors the state of nodes, including their availability, capacity, and health status.
  • The Node Controller ensures that the desired number of nodes specified by the user or configured auto-scaling policies are maintained in the cluster.
  • It handles tasks such as node registration, eviction, and node-level operations like scheduling pods onto nodes based on resource availability and constraints.

CCM for Self-Managed Kubernetes Cluster:

NOTE: CCM works well and integrates seemlessly on Managed Kubernetes Clusters like GKE, EKS etc. Challenges are in the self-managed Kubernetes Cluster. You need to manually create and configure the infrastructure services to work with the self-managed cluster.

To create a LoadBalancer service to expose a pod to outside world, we would create a service as below. This will work fine in GKE, but not in a self-managed kubeadmin cluster.
Because my self-managed cluster would not know how to provison it with a public IP.

YAML
apiVersion: v1
kind: Service
metadata:
  name: cloud-lb
spec:
  type: LoadBalancer
  ports:
  - port: 80
    targetPort: 8080
  selector:
    project: spring-pod-demo
---
apiVersion: v1
kind: Pod
metadata:
  name: spring-petclinic
  labels:
    zone: prod
    version: 3.2.0
    project: spring-pod-demo
    application: spring-petclinic-3.2.0
spec:
  containers:
    - name: spring-petclinic
      image: dockerbikram/spring-petclinic:3.2.0
      imagePullPolicy: Always
      ports:
        - containerPort: 8080

 
    

Deprecated: Earlier, people used Cloud-Provider to integrate with various providers like AWS, GCP and GKE.

There are several options to automate the provision of underlying Cloud Services from Kubernetes and integrate them:

We will explore the installations of various Cloud-Providers Control Managers in a separate article.

Conclusion:

The Cloud Controller Manager plays a pivotal role in enabling Kubernetes clusters to seamlessly integrate with various cloud providers, abstracting away provider-specific complexities and ensuring consistent management of cloud resources. By understanding its architecture, internal workings, and practical usage across different cloud platforms, organizations can leverage the full potential of Kubernetes for deploying and managing cloud-native applications in diverse environments.

The Node Controller manages nodes’ lifecycle, the Route Controller handles routing external traffic to services (in platforms like OpenShift), and the Service Controller manages Kubernetes services, facilitating internal and external access to applications deployed on the cluster. Each controller plays a critical role in maintaining the desired state and functionality of the Kubernetes cluster.

By |Last Updated: April 18th, 2024|Categories: Kubernetes|