Configure container resources and replicas

This pages describes how to configure container resources and replicas for controllers in Config Connector.

Configure resource allocation for a Config Connector controller container

In Config Connector version 1.106 and later, you can configure the CPU and memory (RAM) resources allocated to a container in a Config Connector controller Pod. You can configure the following controllers:

  • cnrm-webhook-manager
  • cnrm-controller-manager
  • cnrm-deletiondefender
  • cnrm-resource-stats-recorder
  • cnrm-unmanaged-detector (Config Connector version 1.108 and later)

There are two types of custom resources used for configuration: ControllerResource and NamespacedControllerResource .

Use ControllerResource for cluster-scoped components

Use the ControllerResource custom resource to configure resources for Config Connector components that run as cluster-scoped deployments.

The following components are always cluster-scoped, even when Config Connector is installed in namespaced mode:

  • cnrm-webhook-manager
  • cnrm-deletiondefender
  • cnrm-resource-stats-recorder
  • cnrm-unmanaged-detector

The cnrm-controller-manager is also cluster-scoped when Config Connector is installed in cluster mode.

For example, to configure the memory request and limit of the webhook container of the cnrm-webhook-manager controller, create and apply the following YAML file:

  apiVersion 
 : 
  
 customize.core.cnrm.cloud.google.com/v1beta1 
 kind 
 : 
  
 ControllerResource 
 metadata 
 : 
  
 name 
 : 
  
 cnrm-webhook-manager 
 spec 
 : 
  
 containers 
 : 
  
 - 
  
 name 
 : 
  
 webhook 
  
 resources 
 : 
  
 limits 
 : 
  
 memory 
 : 
  
 512Mi 
  
 requests 
 : 
  
 memory 
 : 
  
 256Mi 
 

Use NamespacedControllerResource for the namespaced controller manager

Use the NamespacedControllerResource custom resource only to configure resources for the cnrm-controller-manager when Config Connector is running in namespaced mode.

The configuration of container resources for a namespaced controller is enabled in Config Connector version 1.108 and later.

The following YAML file shows an example configuration:

  apiVersion 
 : 
  
 customize.core.cnrm.cloud.google.com/v1beta1 
 kind 
 : 
  
 NamespacedControllerResource 
 metadata 
 : 
  
 name 
 : 
  
 cnrm-controller-manager 
  
 # name should not contain the namespace ID suffix 
  
 namespace 
 : 
  
  NAMESPACE 
 
 spec 
 : 
  
 containers 
 : 
  
 - 
  
 name 
 : 
  
 manager 
  
 resources 
 : 
  
 limits 
 : 
  
 cpu 
 : 
  
 200m 
  
 memory 
 : 
  
 512Mi 
  
 requests 
 : 
  
 cpu 
 : 
  
 100m 
  
 memory 
 : 
  
 256Mi 
 

Replace NAMESPACE with the name of your namespace.

Configure replicas for a Config Connector controller Pod

In Config Connector version 1.107 and later, you can configure the number of replicas for a Config Connector controller. You can only configure the cnrm-webhook-manager .

For example, the following steps show how to configure the number of replicas for the cnrm-webhook-manager controller to 3 .

  1. Create a file named configure-webhook-manager.yaml and copy the following YAML into it:

      apiVersion 
     : 
      
     customize.core.cnrm.cloud.google.com/v1beta1 
     kind 
     : 
      
     ControllerResource 
     metadata 
     : 
      
     name 
     : 
      
     cnrm-webhook-manager 
     spec 
     : 
      
     replicas 
     : 
      
     3 
      
     containers 
     : 
      
     - 
      
     name 
     : 
      
     webhook 
      
     resources 
     : 
      
     limits 
     : 
      
     memory 
     : 
      
     512Mi 
      
     requests 
     : 
      
     memory 
     : 
      
     256Mi 
     
    
  2. Use kubectl apply to apply the modified configuration to your cluster:

    kubectl apply -f configure-webhook-manager.yaml
  3. Verify the successful configuration by running the following command.

    kubectl get controllerresource cnrm-webhook-manager -o jsonpath='{.status.healthy}'

    It should display status.healthy field set to true .

  4. Verify the presence of 3 webhook Pods within your cluster.

    kubectl get pods -n cnrm-system -l cnrm.cloud.google.com/component=cnrm-webhook-manager

    Creating and recreating the Pods could take a few minutes.

Revert configuration changes in container resources and replicas

Use kubectl delete to delete the ControllerResource custom resources that you configured. After deletion, the Config Connector operator recreates the controllers with the default container resources and replicas.

kubectl delete -f configure-webhook-manager.yaml
Create a Mobile Website
View Site in Mobile | Classic
Share by: