Scaling an entire database

The autoscaler allows you to scale specific subclusters by providing a service name. If you need to scale the entire database and make scaling decisions based on all nodes, leave spec.serviceName empty.

In the following sections, we will reference the following VerticaDB:

apiVersion: vertica.com/v1
kind: VerticaDB
metadata:
  name: v-test
spec:
  communal:
    path: "path/to/communal-storage"
    endpoint: "path/to/communal-endpoint"
    credentialSecret: credentials-secret
  licenseSecret: license
  subclusters:
    - name: pri1
      size: 3
      type: primary
      serviceName: primary1
      resources:
        limits:
          cpu: "8"
        requests:
          cpu: "4"
    - name: sec1
      size: 3
      type: secondary
      serviceName: secondary1
      resources:
        limits:
          cpu: "8"
        requests:
          cpu: "4"

Horizontal Pod Autoscaler

apiVersion: vertica.com/v1beta1
kind: VerticaAutoscaler
metadata:
  name: v-scale
  verticaDBName: v-test
  scalingGranularity: Subcluster
  template:
    name: as
    size: 3
    serviceName: newsvc
    type: secondary 
  customAutoscaler:
    type: HPA
    hpa:
      minReplicas: 3
      maxReplicas: 12
      metrics:
        - metric:
            type: Pods
            pods:
              metric:
                name: vertica_sessions_running_total
              target:
                type: AverageValue
                averageValue: 50

spec.template serves as a blueprint for new subclusters added when scaling out.

Currently, the database consists of six nodes distributed across two subclusters and all of them will be used for calculating the metric value. If scaling is needed and target size - current size exceeds template.size, new subclusters will be added, each with its own dedicated service.

ScaledObject

apiVersion: vertica.com/v1
kind: VerticaAutoscaler
metadata:
  name: v-scale
spec:
  verticaDBName: v-test
  serviceName: primary1
  scalingGranularity: Subcluster
  customAutoscaler:
    type: ScaledObject
    scaledObject:
      minReplicas: 3
      maxReplicas: 12
      metrics:
      - name: vertica_sessions_running_total
        metricType: AverageValue
        prometheus:
          serverAddress: "http://prometheus-kube-prometheus-prometheus.prometheus.svc.cluster.local:9090"
          query: sum(vertica_sessions_running_counter{type="active", initiator="user", pod=~"v-test-.*"})
          threshold: 50

Currently, the database consists of six nodes distributed across two subclusters and all of them will be used for calculating the metric value. If scaling is needed and target size - current size exceeds template.size, new subclusters will be added, each with its own dedicated service.