BRIX On-Premises / Configure parameters of portable services using ConfigMap

Configure parameters of portable services using ConfigMap

You can set limits and parameters for deploying microservices from portable services in modules using ConfigMap. This allows you to limit the dedicated resources, define the number of microservice instances that are deployed in Kubernetes, and configure their autoscaling. In addition, you can configure the distribution of microservice pods across cluster nodes in ConfigMap.

You can specify global settings for portable services configured in all modules of the system, as well as add individual settings for a specific service.

You can use ConfigMap for:

  • Fine tuning of microservice deployment. You can specify parameter values that are not available when editing a portable service in a module.
  • Changing settings without editing the module. It is useful for paid modules. For example, you can set the number of microservice instances because the parameter in ConfigMap is prioritized over the value set by the developer when creating the module.

To configure ConfigMap, do the following steps:

  1. Enable ConfigMap.
  2. Set parameters in ConfigMap.

Step 1: Enable ConfigMap

To use ConfigMap for configuration of portable services, enable the ELMA365_BABYSITTER_ENABLE_CONFIGMAP_WATCHER environment variable for the babysitter service. To do this, make changes to the values-elma365.yaml configuration file:

  1. Create a backup copy of the values-elma365.yaml file filled in when installing BRIX. This is required before editing, as incorrect parameter settings may cause BRIX application malfunction.
  1. In the values-elma365.yaml configuration file, enable the following parameters:

global:
...
# Enable portable services
    managedServices:
        enabled: true
...
# ConfigMap use
        watchableConfigMap:
          enabled: true

  1. Update the BRIX application using the following command:

helm upgrade elma365 ./elma365 -f values-elma365.yaml --timeout=30m

After that, a file that stores ConfigMap parameters will be automatically created. It will be added to the namespace where the portable services are placed, which is elma365-applets by default. The file is preconfigured with a ConfigMap named elma365-babysitter-config. For correct operation, it is recommended to not change the default name.

Now you can set the parameters in ConfigMap.

To return to the default settings and start the configuration again, delete the cfg.yaml file and run the following command to regenerate it:

kubectl apply -f cfg.yaml -n elma365-applets

Where elma365-applets is the namespace for placing the portable services.

Step 2: Set parameters in ConfigMap

To change the settings:

  1. Run the command to open the ConfigMap file for editing:

kubectl edit configmap elma365-babysitter-config -n elma365-applets

Where:

  • elma365-babysitter-config is the name of the ConfigMap in the cfg.yaml file.
  • elma365-applets is the namespace that hosts the portable services.
  1. In the opened file, set:
  • Global parameters. They are applied by default to portable services in all modules. Set them in the global block.
  • Parameters for a particular service. To set them, add a block with the service name according to the template: {company}.ext_{id}.{unique_name} where:
    • company is the BRIX company code. You can find it in its URL address.
    • id is the identifier of the module where the portable service is configured. You can copy it from the URL address of the module in BRIX.
    • unique_name is the unique name of the portable service from the module settings.

ConfigMap example

Available parameters:

  1. Resources (resources):
  • requests are memory and CPU resources to be dedicated for the microservice.
  • limits is the maximum values of dedicated resources.

Read more about possible values of these parameters in the official Kubernetes documentation.

начало примера

Example

resources:
 requests:
   memory: "512Mi"
   cpu: "500m"
 limits:
   memory: "2048Mi"
   cpu: "1000m"

конец примера

  1. Number of instances (replicaCount). How many pods to start for the microservice. Available values: 0-32k.

начало примера

Example

replicaCount: 4

конец примера

  1. Autoscaling (autoscaling):
  • enabled enables autoscaling.
  • minReplicas is the minimum number of microservice instances. Available values: 0-32k.
  • maxReplicas is the maximum number of instances. Available values: 0-32k.
  • targetMemoryUtilizationPercentage is desired memory usage in percentage. Available values: 0-100.
  • targetCPUUtilizationPercentage is desired CPU resource utilization in percentage. Available values: 0-100.

начало примера

Example

autoscaling:
  enabled: true
  minReplicas: 1
  maxReplicas: 9
  targetMemoryUtilizationPercentage: 80
  targetCPUUtilizationPercentage: 80

конец примера

  1. Select nodes for pod placement (nodeSelector). Configure microservices pods to be placed on specific cluster nodes using special tags.

Read more about using the parameter in the official Kubernetes documentation.

начало примера

Example

nodeSelector:
  role: brix
  disk: ssd

конец примера

  1. Tolerations for placing pods (tolerations). Set tolerations for microservice pods so that they can be placed on nodes with appropriate taints.

начало примера

Example

tolerations:
  - effect: NoSchedule
    key: dedicated
    operator: Equal
    value: monitoring

конец примера

  1. After making the changes, apply them using the command specifying the namespace that hosts the portable services:

kubectl apply -f cfg.yaml -n elma365-applets

The settings will be applied automatically as the babysitter service tracks changes in ConfigMap. All microservices for which the settings have changed will restart.