Running KEDA ScaledObject autoscaler on OpenShift
The VerticaAutoscaler custom resource (CR) supports two types of autoscaler, Horizontal Pod Autoscaler (HPA) and ScaledObject. In OpenShift, HPA has limited support for scaling based on Prometheus metrics as it relies on the Prometheus adapter, which is challenging to install. For OpenShift environments, ScaledObject is the recommended autoscaler.
To set up VerticaAutoscaler with ScaledObject in Openshift:
-
On OperatorHub Marketplace locate and install Custom Metrics Autoscaler. This installs all the required custom resources.
-
Navigate to Installed Operators, and select Custom Metrics Autoscaler. From the list of APIs, select KedaController and create an instance. You can keep the default values and ensure that
watchNamespace
is empty.Select YAML view to view the yaml file:
kind: KedaController apiversion: keda.sh/v1alpha1 metadata: name: keda namespace: opensfhits-keda spec: admissionWebhooks: logEncoder: console logLevel: info metricsServer: logLevel: '0' operator: logEncoder: console logLevel: info serviceAccount: null watchNamespace: ''
-
Next, deploy the VerticaAutoscaler CR with ScaledObject. For example:
apiVersion: vertica.com/v1 kind: VerticaAutoscaler metadata: name: v-scale spec: verticaDBName: v-test serviceName: primary1 scalingGranularity: Pod 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", service="v-test-primary1"}) threshold: 50