$ oc delete crd scaledobjects.keda.k8s.io
You can use the OKD web console to install the Custom Metrics Autoscaler Operator.
The installation creates the following five CRDs:
ClusterTriggerAuthentication
KedaController
ScaledJob
ScaledObject
TriggerAuthentication
The installation process also creates the KedaController custom resource (CR). You can modify the default KedaController CR, if needed. For more information, see "Editing the Keda Controller CR".
|
If you are installing a Custom Metrics Autoscaler Operator version lower than 2.17.2, you must manually create the Keda Controller CR. You can use the procedure described in "Editing the Keda Controller CR" to create the CR. |
You can optionally install the HTTP Add-on extension to enable HTTP traffic-based autoscaling for your applications. The HTTP Add-on allows you to scale applications from zero replicas during low traffic periods, providing significant cost savings for variable-load HTTP workloads.
For detailed information about installing the HTTP Add-on, see "Install the KEDA HTTP Add-on extension". For information on HTTP-based scaling, see "Scaling applications based on HTTP traffic".
You can use the following procedure to install the Custom Metrics Autoscaler Operator.
Ensure that you have downloaded the pull secret from Red Hat OpenShift Cluster Manager as shown in Obtaining the installation program in the installation documentation for your platform.
If you have the pull secret, add the redhat-operators catalog to the OperatorHub custom resource (CR) as shown in Configuring OKD to use Red Hat Operators.
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
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
In the OKD web console, click Ecosystem → Software Catalog.
Choose Custom Metrics Autoscaler from the list of available Operators, and click Install.
On the Install Operator page, ensure that the All namespaces on the cluster (default) option is selected for Installation Mode. This installs the Operator in all namespaces.
Ensure that the openshift-keda namespace is selected for Installed Namespace. OKD creates the namespace, if not present in your cluster.
Click Install.
Verify the installation by listing the Custom Metrics Autoscaler Operator components:
Navigate to Workloads → Pods.
Select the openshift-keda project from the drop-down menu and verify that the custom-metrics-autoscaler-operator-* pod is running.
Navigate to Workloads → Deployments to verify that the custom-metrics-autoscaler-operator deployment is running.
Optional: Verify the installation in the OpenShift CLI using the following commands:
$ oc get all -n openshift-keda
The output appears similar to the following:
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
After installing the Custom Metrics Autoscaler Operator, you can enable the HTTP Add-on to configure HTTP-traffic-based autoscaling for your applications. You enable the HTTP Add-on through the KedaController custom resource.
The Custom Metrics Autoscaler Operator version 2.20 or later is installed in your cluster.
You have cluster-admin permissions.
You are logged in to the OKD web console.
In the OKD web console, click Ecosystem → Installed Operators.
Switch to the openshift-keda project.
Click Custom Metrics Autoscaler.
On the Operator Details page, click the KedaController tab.
Click the keda custom resource, and then click the YAML tab.
Set spec.httpAddon.enabled to true:
apiVersion: keda.sh/v1alpha1
kind: KedaController
metadata:
name: keda
namespace: openshift-keda
spec:
httpAddon:
enabled: true
When true, the spec.httpAddon.enabled parameter enables the HTTP Add-on operator, interceptor, and scaler components. The default is false.
Click Save.
Optional: Configure the HTTP Add-on interceptor:
spec:
httpAddon:
enabled: true
interceptor:
replicas: 3
env:
- name: KEDA_HTTP_DIRECT_POD_ROUTING
value: "true"
where:
spec.httpAddon.interceptor.replicas specifies the number of interceptor replicas. Increase this value when the interceptor itself needs more capacity.
spec.httpAddon.interceptor.env, when the KEDA_HTTP_DIRECT_POD_ROUTING environment variable is set to true, the interceptor forwards requests directly to a pod IP and not the service itself. Set to false if your application uses session affinity, topology-aware routing, or a network policy on the service path. When false, direct pod routing is disabled so that the interceptor uses the service itself.
Confirm that the HTTP Add-on installation succeeded by running the following command:
$ oc get kedacontroller keda -n openshift-keda -o yaml
Confirm that status.httpAddon.phase is Installation Succeeded.
apiVersion: keda.sh/v1alpha1
kind: KedaController
metadata:
name: keda
namespace: openshift-keda
# ...
status:
httpAddon:
phase: Installation Succeeded
reason: HTTP Add-on v<version> is installed in namespace 'openshift-keda'
Where <version> is the HTTP Add-on operator version.
Confirm that the HTTP Add-on workloads are operating by running the following command:
$ oc get deploy,svc -n openshift-keda
The command lists deployments for the HTTP Add-on operator, the interceptor, and the scaler components in the openshift-keda namespace. The services include keda-add-ons-http-external-scaler and keda-add-ons-http-interceptor-proxy.
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/custom-metrics-autoscaler-operator 1/1 1 1 32m
deployment.apps/keda-add-ons-http-interceptor 1/1 1 1 4m2s
deployment.apps/keda-add-ons-http-operator 1/1 1 1 4m2s
deployment.apps/keda-add-ons-http-scaler 1/1 1 1 4m1s
deployment.apps/keda-admission 1/1 1 1 31m
deployment.apps/keda-metrics-apiserver 1/1 1 1 31m
deployment.apps/keda-operator 1/1 1 1 31m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/keda-add-ons-http-external-scaler ClusterIP 172.30.120.196 <none> 9090/TCP 4m1s
service/keda-add-ons-http-interceptor-admin ClusterIP 172.30.193.173 <none> 9090/TCP 4m2s
service/keda-add-ons-http-interceptor-metrics ClusterIP 172.30.54.183 <none> 2223/TCP 4m2s
service/keda-add-ons-http-interceptor-proxy ClusterIP 172.30.157.1 <none> 8080/TCP,8443/TCP 4m2s
service/keda-add-ons-http-operator-metrics ClusterIP 172.30.53.221 <none> 8080/TCP,8443/TCP 4m2s
service/keda-admission-webhooks ClusterIP 172.30.2.252 <none> 443/TCP,8080/TCP 31m
service/keda-metrics-apiserver ClusterIP 172.30.142.117 <none> 443/TCP,8080/TCP 31m
service/keda-operator ClusterIP 172.30.21.135 <none> 9666/TCP,8080/TCP 31m
Learn about HTTP-based scaling. See "Scaling applications based on HTTP traffic".
Configure HTTP-based autoscaling for your application by creating an InterceptorRoute and ScaledObject. See "Configure HTTP-based autoscaling for your application".
You can use the following procedure to modify the KedaController custom resource (CR), which is automatically installed during the installation of the Custom Metrics Autoscaler Operator.
In the OKD web console, click Ecosystem → Installed Operators.
Click Custom Metrics Autoscaler.
On the Operator Details page, click the KedaController tab.
On the KedaController tab, click Create KedaController and edit the file.
kind: KedaController
apiVersion: keda.sh/v1alpha1
metadata:
name: keda
namespace: openshift-keda
spec:
watchNamespace: ''
operator:
logLevel: info
logEncoder: console
caConfigMaps:
- thanos-cert
- kafka-cert
replicas: 2
volumeMounts:
- mountPath: /<path_to_directory>
name: <name>
volumes:
- name: <volume_name>
emptyDir:
medium: Memory
env:
- name: KEDA_HTTP_DEFAULT_TIMEOUT
value: "10000"
metricsServer:
logLevel: '0'
auditConfig:
logFormat: "json"
logOutputVolumeClaim: "persistentVolumeClaimName"
policy:
rules:
- level: Metadata
omitStages: ["RequestReceived"]
omitManagedFields: false
lifetime:
maxAge: "2"
maxBackup: "1"
maxSize: "50"
env:
- name: HTTPS_PROXY
value: "http://proxy.server:port"
replicas: 2
admissionWebhooks:
env:
- name: KEDA_SERVICE_MIN_TLS_VERSION
value: "TLS12"
replicas: 2
serviceAccount: {}
where:
spec.watchNamespaceSpecifies a single namespace in which the Custom Metrics Autoscaler Operator scales 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.
spec.operator.logLevelSpecifies the level of verbosity for the Custom Metrics Autoscaler Operator log messages. The allowed values are debug, info, error. The default is info.
spec.operator.logEncoderSpecifies the logging format for the Custom Metrics Autoscaler Operator log messages. The allowed values are console or json. The default is console.
spec.operator.caConfigMapsSpecifies one or more config maps with CA certificates, which the Custom Metrics Autoscaler Operator can use to connect securely to TLS-enabled metrics sources. This field is optional.
spec.operator.replicasSpecifies the number of replicas for the Custom Metrics Autoscaler Operator pod. Specifying 2 replicas enables high availability for the Operator, with one replica on standby. For example, by creating multiple replicas, the scheduler can place one operator pod in each of your availability zones. If the zone that holds the active replica fails, a standby replica in another zone can become the leader. The minimum number of replicas allowed is 1. There is no maximum. The default is 1.
spec.operator.volumeMountsSpecifies the container mount path. This field is optional.
spec.operator.volumesSpecifies a volumes block to list each projected volume source. This field is optional.
spec.operator.envSpecifies environment variables that configure the Custom Metrics Autoscaler Keda operator component. For each environment variable, specify a name and value. For example:
KEDA_HTTP_DEFAULT_TIMEOUT configures a uniform timeout duration for all HTTP-based metrics providers, specified by the value setting in milliseconds. If not specified, outbound HTTP requests initiated by individual scalers fall back to hard-coded client defaults, which can cause failures in high-latency network environments.
spec.metricsServer.logLevelSpecifies the logging level for the Custom Metrics Autoscaler metrics server. The allowed values are 0 for info and 4 for debug. The default is 0.
spec.metricsServer.auditConfigSpecifies the audit logging configuration for the Custom Metrics Autoscaler Operator and the audit policy to use, as described in the "Configuring audit logging" section.
spec.metricsServer.envSpecifies specific environment variables that configure the Custom Metrics Autoscaler Metrics Server component. For each environment variable, specify a name and value.
spec.metricsServer.replicasSpecifies the number of replicas for the Custom Metrics Autoscaler metrics server pod. Specifying more than one replica enables high availability for the component. The minimum is 1. There is no maximum. The default is 1.
spec.admissionWebhooks.envSpecifies specific environment variables that configure the Custom Metrics Autoscaler admission webhooks component. For each environment variable, specify a name and value.
spec.admissionWebhooks.replicasSpecifies the number of replicas for the Custom Metrics Autoscaler admission webhooks pod. Specifying more than one replica enables high availability for the component. The minimum is 1. There is no maximum. The default is 1.
For the env parameters, see the list of available environment variables at Cluster in the KEDA documentation. Specifying a variable outside that list has no effect and no error is returned.
Click Save to save the changes.