You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/nodes-cma-autoscaling-custom-creating-workload.adoc
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,12 +140,12 @@ spec:
140
140
<8> Optional: Specifies the maximum number of replicas when scaling up. The default is `100`.
141
141
<9> Optional: Specifies the minimum number of replicas when scaling down.
142
142
<10> Optional: Specifies the parameters for audit logs. as described in the "Configuring audit logging" section.
143
-
<11> Optional: Specifies the number of replicas to fall back to if a scaler fails to get metrics from the source for the number of times defined by the `failureThreshold` parameter. For more information on fallback behavior, see the link:https://keda.sh/docs/2.7/concepts/scaling-deployments/#fallback[KEDA documentation].
144
-
<12> Optional: Specifies the replica count to be used in the event of a fall back. Enter one of the following options or omit the parameter:
145
-
* Enter `static` to use the number of replicas specified by the `fallback.replicas` parameter.
143
+
<11> Optional: Specifies the number of replicas to fall back to if a scaler fails to get metrics from the source for the number of times defined by the `failureThreshold` parameter. For more information on fallback behavior, see the link:https://keda.sh/docs/latest/reference/scaledobject-spec/#fallback[KEDA documentation].
144
+
<12> Optional: Specifies the replica count to be used if a fallback occurs. Enter one of the following options or omit the parameter:
145
+
* Enter `static` to use the number of replicas specified by the `fallback.replicas` parameter. This is the default.
146
146
* Enter `currentReplicas` to maintain the current number of replicas.
147
-
* Enter `currentReplicasIfHigher` to maintain the current number of replicas, if that number is higher than the `fallback.replicas` parameter. If the current number is lower, use the `fallback.replicas` value.
148
-
* Enter `currentReplicasIfLower` to maintain the current number of replicas, if that number is lower than the `fallback.replicas` parameter. If the current number is higher, use the `fallback.replicas` value.
147
+
* Enter `currentReplicasIfHigher` to maintain the current number of replicas, if that number is higher than the `fallback.replicas` parameter. If the current number of replicas is lower than the `fallback.replicas` parameter, use the `fallback.replicas` value.
148
+
* Enter `currentReplicasIfLower` to maintain the current number of replicas, if that number is lower than the `fallback.replicas` parameter. If the current number of replicas is higher than the `fallback.replicas` parameter, use the `fallback.replicas` value.
149
149
<13> Optional: Specifies the interval in seconds to check each trigger on. The default is `30`.
150
150
<14> Optional: Specifies whether to scale back the target resource to the original replica count after the scaled object is deleted. The default is `false`, which keeps the replica count as it is when the scaled object is deleted.
151
151
<15> Optional: Specifies a name for the horizontal pod autoscaler. The default is `keda-hpa-{scaled-object-name}`.
@@ -193,4 +193,3 @@ Note the following fields in the output:
193
193
** If `False`, the custom metrics autoscaler is getting metrics.
194
194
** If `True`, the custom metrics autoscaler is getting metrics because there are no metrics or there is a problem in one or more of the objects you created.
Copy file name to clipboardExpand all lines: modules/nodes-cma-autoscaling-custom-trigger-auth-using.adoc
+44-18Lines changed: 44 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,43 +12,69 @@ You use trigger authentications and cluster trigger authentications by using a c
12
12
13
13
* The Custom Metrics Autoscaler Operator must be installed.
14
14
15
-
* If you are using a secret, the `Secret` object must exist, for example:
15
+
* If you are using a bound service account token, the service account must exist.
16
+
17
+
* If you are using a bound service account token, a role-based access control (RBAC) object that enables the Custom Metrics Autoscaler Operator to request service account tokens from the service account must exist.
16
18
+
17
-
.Example secret
18
19
[source,yaml]
19
20
----
20
-
apiVersion: v1
21
-
kind: Secret
21
+
apiVersion: rbac.authorization.k8s.io/v1
22
+
kind: Role
23
+
metadata:
24
+
name: keda-operator-token-creator
25
+
namespace: <namespace_name> <1>
26
+
rules:
27
+
- apiGroups:
28
+
- ""
29
+
resources:
30
+
- serviceaccounts/token
31
+
verbs:
32
+
- create
33
+
resourceNames:
34
+
- thanos <2>
35
+
---
36
+
apiVersion: rbac.authorization.k8s.io/v1
37
+
kind: RoleBinding
22
38
metadata:
23
-
name: my-secret
24
-
data:
25
-
user-name: <base64_USER_NAME>
26
-
password: <base64_USER_PASSWORD>
39
+
name: keda-operator-token-creator-binding
40
+
namespace: <namespace_name> <3>
41
+
roleRef:
42
+
apiGroup: rbac.authorization.k8s.io
43
+
kind: Role
44
+
name: keda-operator-token-creator
45
+
subjects:
46
+
- kind: ServiceAccount
47
+
name: keda-operator
48
+
namespace: openshift-keda
27
49
----
50
+
<1> Specifies the namespace of the service account.
51
+
<2> Specifies the name of the service account.
52
+
<3> Specifies the namespace of the service account.
53
+
54
+
* If you are using a secret, the `Secret` object must exist.
28
55
29
56
.Procedure
30
57
31
58
. Create the `TriggerAuthentication` or `ClusterTriggerAuthentication` object.
32
59
33
60
.. Create a YAML file that defines the object:
34
61
+
35
-
.Example trigger authentication with a secret
62
+
.Example trigger authentication with a bound service account token
36
63
[source,yaml]
37
64
----
38
65
kind: TriggerAuthentication
39
66
apiVersion: keda.sh/v1alpha1
40
67
metadata:
41
68
name: prom-triggerauthentication
42
-
namespace: my-namespace
43
-
spec:
44
-
secretTargetRef:
45
-
- parameter: user-name
46
-
name: my-secret
47
-
key: USER_NAME
48
-
- parameter: password
49
-
name: my-secret
50
-
key: USER_PASSWORD
69
+
namespace: my-namespace <1>
70
+
spec:
71
+
boundServiceAccountToken: <2>
72
+
- parameter: token
73
+
serviceAccountName: thanos <3>
51
74
----
75
+
<1> Specifies the namespace of the object you want to scale.
76
+
<2> Specifies that this trigger authentication uses a bound service account token for authorization when connecting to the metrics endpoint.
77
+
<3> Specifies the name of the service account to use.
Copy file name to clipboardExpand all lines: modules/nodes-cma-autoscaling-custom-trigger-prom.adoc
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,7 @@ spec:
35
35
cortexOrgID: my-org <8>
36
36
ignoreNullValues: "false" <9>
37
37
unsafeSsl: "false" <10>
38
+
timeout: 1000 <11>
38
39
----
39
40
<1> Specifies Prometheus as the trigger type.
40
41
<2> Specifies the address of the Prometheus server. This example uses {product-title} monitoring.
@@ -51,7 +52,10 @@ spec:
51
52
* If `false`, the certificate check is performed. This is the default behavior.
52
53
* If `true`, the certificate check is not performed.
53
54
+
55
+
--
54
56
[IMPORTANT]
55
57
====
56
58
Skipping the check is not recommended.
57
59
====
60
+
--
61
+
<11> Optional: Specifies an HTTP request timeout in milliseconds for the HTTP client used by this Prometheus trigger. This value overrides any global timeout setting.
You can scale pods based on the number of pods matching a specific label selector.
10
+
11
+
The Custom Metrics Autoscaler Operator tracks the number of pods with a specific label that are in the same namespace, then calculates a _relation_ based on the number of labeled pods to the pods for the scaled object. Using this relation, the Custom Metrics Autoscaler Operator scales the object according to the scaling policy in the `ScaledObject` or `ScaledJob` specification.
12
+
13
+
The pod counts includes pods with a `Succeeded` or `Failed` phase.
14
+
15
+
For example, if you have a `frontend` deployment and a `backend` deployment. You can use a `kubernetes-workload` trigger to scale the `backend` deployment based on the number of `frontend` pods. If number of `frontend` pods goes up, the Operator would scale the `backend` pods to maintain the specified ratio. In this example, if there are 10 pods with the `app=frontend` pod selector, the Operator scales the backend pods to 5 in order to maintain the `0.5` ratio set in the scaled object.
16
+
17
+
.Example scaled object with a Kubernetes workload trigger
18
+
[source,yaml]
19
+
----
20
+
apiVersion: keda.sh/v1alpha1
21
+
kind: ScaledObject
22
+
metadata:
23
+
name: workload-scaledobject
24
+
namespace: my-namespace
25
+
spec:
26
+
triggers:
27
+
- type: kubernetes-workload <1>
28
+
metadata:
29
+
podSelector: 'app=frontend' <2>
30
+
value: '0.5' <3>
31
+
activationValue: '3.1' <4>
32
+
----
33
+
<1> Specifies a Kubernetes workload trigger.
34
+
<2> Specifies one or more pod selectors and/or set-based selectors, separated with commas, to use to get the pod count.
35
+
<3> Specifies the target relation between the scaled workload and the number of pods that match the selector. The relation is calculated following the following formula:
36
+
+
37
+
----
38
+
relation = (pods that match the selector) / (scaled workload pods)
39
+
----
40
+
+
41
+
<4> Optional: Specifies the target value for scaler activation phase. The default is `0`.
0 commit comments