This is a cache of https://docs.openshift.com/dedicated/nodes/cma/nodes-cma-autoscaling-custom-install.html. It is a snapshot of the page at 2024-11-21T05:23:18.597+0000.
Installing the custom metrics autoscaler - Automatically scaling pods with the Custom Metrics Autoscaler Operator | Nodes | OpenShift Dedicated
×

You can use the OpenShift Dedicated web console to install the Custom Metrics Autoscaler Operator.

The installation creates the following five CRDs:

  • ClusterTriggerAuthentication

  • KedaController

  • ScaledJob

  • ScaledObject

  • TriggerAuthentication

Installing the custom metrics autoscaler

You can use the following procedure to install the Custom Metrics Autoscaler Operator.

Prerequisites
  • You have access to the cluster as a user with the cluster-admin role.

    If your OpenShift Dedicated cluster is in a cloud account that is owned by Red Hat (non-CCS), you must request cluster-admin privileges.

  • Remove any previously-installed Technology Preview versions of the Cluster Metrics Autoscaler Operator.

  • Remove any versions of the community-based KEDA.

    Also, remove the KEDA 1.x custom resource definitions by running the following commands:

    $ oc delete crd scaledobjects.keda.k8s.io
    $ oc delete crd triggerauthentications.keda.k8s.io
  • Ensure that the keda namespace exists. If not, you must manaully create the keda namespace.

  • Optional: If you need the Custom Metrics Autoscaler Operator to connect to off-cluster services, such as an external Kafka cluster or an external Prometheus service, put any required service CA certificates into a config map. The config map must exist in the same namespace where the Operator is installed. For example:

    $ oc create configmap -n openshift-keda thanos-cert  --from-file=ca-cert.pem
Procedure
  1. In the OpenShift Dedicated web console, click OperatorsOperatorHub.

  2. Choose Custom Metrics Autoscaler from the list of available Operators, and click Install.

  3. On the Install Operator page, ensure that the A specific namespace on the cluster option is selected for Installation Mode.

  4. For Installed Namespace, click Select a namespace.

  5. Click Select Project:

    • If the keda namespace exists, select keda from the list.

    • If the keda namespace does not exist:

      1. Select Create Project to open the Create Project window.

      2. In the Name field, enter keda.

      3. In the Display Name field, enter a descriptive name, such as keda.

      4. Optional: In the Display Name field, add a description for the namespace.

      5. Click Create.

  6. Click Install.

  7. Verify the installation by listing the Custom Metrics Autoscaler Operator components:

    1. Navigate to WorkloadsPods.

    2. Select the keda project from the drop-down menu and verify that the custom-metrics-autoscaler-operator-* pod is running.

    3. Navigate to WorkloadsDeployments to verify that the custom-metrics-autoscaler-operator deployment is running.

  8. Optional: Verify the installation in the OpenShift CLI using the following command:

    $ oc get all -n keda

    The output appears similar to the following:

    Example output
    NAME                                                      READY   STATUS    RESTARTS   AGE
    pod/custom-metrics-autoscaler-operator-5fd8d9ffd8-xt4xp   1/1     Running   0          18m
    
    NAME                                                 READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/custom-metrics-autoscaler-operator   1/1     1            1           18m
    
    NAME                                                            DESIRED   CURRENT   READY   AGE
    replicaset.apps/custom-metrics-autoscaler-operator-5fd8d9ffd8   1         1         1       18m
  9. Install the KedaController custom resource, which creates the required CRDs:

    1. In the OpenShift Dedicated web console, click OperatorsInstalled Operators.

    2. Click Custom Metrics Autoscaler.

    3. On the Operator Details page, click the KedaController tab.

    4. On the KedaController tab, click Create KedaController and edit the file.

      kind: KedaController
      apiVersion: keda.sh/v1alpha1
      metadata:
        name: keda
        namespace: keda
      spec:
        watchNamespace: '' (1)
        operator:
          logLevel: info (2)
          logEncoder: console (3)
          caConfigMaps: (4)
          - thanos-cert
          - kafka-cert
        metricsServer:
          logLevel: '0' (5)
          auditConfig: (6)
            logFormat: "json"
            logOutputVolumeClaim: "persistentVolumeClaimName"
            policy:
              rules:
              - level: Metadata
              omitStages: ["RequestReceived"]
              omitManagedFields: false
            lifetime:
              maxAge: "2"
              maxBackup: "1"
              maxSize: "50"
        serviceAccount: {}
      1 Specifies a single namespace in which the Custom Metrics Autoscaler Operator should scale applications. Leave it blank or leave it empty to scale applications in all namespaces. This field should have a namespace or be empty. The default value is empty.
      2 Specifies the level of verbosity for the Custom Metrics Autoscaler Operator log messages. The allowed values are debug, info, error. The default is info.
      3 Specifies the logging format for the Custom Metrics Autoscaler Operator log messages. The allowed values are console or json. The default is console.
      4 Optional: Specifies one or more config maps with CA certificates, which the Custom Metrics Autoscaler Operator can use to connect securely to TLS-enabled metrics sources.
      5 Specifies the logging level for the Custom Metrics Autoscaler Metrics Server. The allowed values are 0 for info and 4 or debug. The default is 0.
      6 Activates audit logging for the Custom Metrics Autoscaler Operator and specifies the audit policy to use, as described in the "Configuring audit logging" section.
    5. Click Create to create the KEDA controller.