Configure Horizontal Pod Autoscaling (HPA)

This page details the configuration of the autoscaling system for pods. Autoscaling allows you to dynamically adjust the number of pods based on load (CPU and RAM).

Technical Prerequisites

For the HPA to work, the following conditions must be met:

  1. Metrics-server: Must be installed on the cluster (to expose cpu and memory metrics).

  2. Resource Requests: Your pods must have CPU/RAM requests and limits defined. The percentage calculation is based on these values. Default values are defined for Cyberwatch pods, but they can be adjusted in the values.yml file.

Implementation example

Copy this configuration into your values.yml file to enable autoscaling:

autoscaling:
  # Enables or disables resource autoscaling for the cluster
  enabled: true
  
  targets:
    - name: sidekiq-node
      minReplicas: 1      # Number of pods kept alive even with no activity
      maxReplicas: 5      # Maximum number of pods that autoscaling can create
      targetCPUUsage: 70  # Triggers a new pod if average CPU usage exceeds 70%
      targetRAMUsage: 80  # Triggers a new pod if average RAM usage exceeds 80%

    - name: container-scanner
      minReplicas: 1
      maxReplicas: 10
      targetCPUUsage: 70
      targetRAMUsage: 80

Back to top

Anglais Français