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
# Deployments autoscaling on ECK [k8s-autoscaling]
11
+
Configure autoscaling for Elasticsearch deployments in {{eck}}. Learn how to enable autoscaling, define policies, manage resource limits, and monitor scaling. Includes details on autoscaling stateless applications like Kibana, APM Server, and Elastic Maps Server.
12
+
13
+
## Deployments autoscaling on ECK [k8s-autoscaling]
10
14
11
15
::::{note}
12
16
Elasticsearch autoscaling requires a valid Enterprise license or Enterprise trial license. Check [the license documentation](../license/manage-your-license-in-eck.md) for more details about managing licenses.
@@ -16,12 +20,12 @@ Elasticsearch autoscaling requires a valid Enterprise license or Enterprise tria
16
20
ECK can leverage the [autoscaling API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-autoscaling) introduced in Elasticsearch 7.11 to adjust automatically the number of Pods and the allocated resources in a tier. Currently, autoscaling is supported for Elasticsearch [data tiers](/manage-data/lifecycle/data-tiers.md) and machine learning nodes.
17
21
18
22
19
-
## Enable autoscaling [k8s-enable]
23
+
###Enable autoscaling [k8s-enable]
20
24
21
25
To enable autoscaling on an Elasticsearch cluster, you need to define one or more autoscaling policies. Each autoscaling policy applies to one or more NodeSets which share the same set of roles specified in the `node.roles` setting in the Elasticsearch configuration.
Autoscaling policies can be defined in an `ElasticsearchAutoscaler` resource. Each autoscaling policy must have the following fields:
27
31
@@ -93,7 +97,7 @@ In the case of storage the following restrictions apply:
93
97
* Scaling up (vertically) is only supported if the available capacity in a PersistentVolume matches the capacity claimed in the PersistentVolumeClaim. Refer to the next section for more information.
94
98
95
99
96
-
### Scale Up and Scale Out [k8s-autoscaling-algorithm]
100
+
#### Scale Up and Scale Out [k8s-autoscaling-algorithm]
97
101
98
102
In order to adapt the resources to the workload, the operator first attempts to scale up the resources (cpu, memory, and storage) allocated to each node in the NodeSets. The operator always ensures that the requested resources are within the limits specified in the autoscaling policy. If each individual node has reached the limits specified in the autoscaling policy, but more resources are required to handle the load, then the operator adds some nodes to the NodeSets. Nodes are added up to the `max` value specified in the `nodeCount` of the policy.
99
103
@@ -129,7 +133,7 @@ spec:
129
133
```
130
134
131
135
132
-
### Set the limits [k8s-autoscaling-resources]
136
+
#### Set the limits [k8s-autoscaling-resources]
133
137
134
138
The value set for memory and CPU limits are computed by applying a ratio to the calculated resource request. The default ratio between the request and the limit for both CPU and memory is 1. This means that request and limit have the same value. You can change the default ratio between the request and the limit for both the CPU and memory ranges by using the `requestsToLimitsRatio` field.
135
139
@@ -165,7 +169,7 @@ spec:
165
169
You can find [a complete example in the ECK GitHub repository](https://github.com/elastic/cloud-on-k8s/blob/2.16/config/recipes/autoscaling/elasticsearch.yaml) which will also show you how to fine-tune the [autoscaling deciders](/deploy-manage/autoscaling/autoscaling-deciders.md).
166
170
167
171
168
-
### Change the polling interval [k8s-autoscaling-polling-interval]
172
+
#### Change the polling interval [k8s-autoscaling-polling-interval]
169
173
170
174
The Elasticsearch autoscaling capacity endpoint is polled every minute by the operator. This interval duration can be controlled using the `pollingPeriod` field in the autoscaling specification:
171
175
@@ -197,10 +201,10 @@ spec:
197
201
```
198
202
199
203
200
-
## Monitoring [k8s-monitoring]
204
+
### Monitoring [k8s-monitoring]
201
205
202
206
203
-
### Autoscaling status [k8s-autoscaling-status]
207
+
#### Autoscaling status [k8s-autoscaling-status]
204
208
205
209
In addition to the logs generated by the operator, an autoscaling status is maintained in the `ElasticsearchAutoscaler` resource. This status holds several `Conditions` to summarize the health and the status of the autoscaling mechanism. For example, dedicated `Conditions` may report if the controller cannot connect to the Elasticsearch cluster, or if a resource limit has been reached:
206
210
@@ -237,7 +241,7 @@ kubectl get elasticsearchautoscaler autoscaling-sample \
The autoscaler status also contains a `policies` section which describes the expected resources for each NodeSet managed by an autoscaling policy.
243
247
@@ -273,7 +277,7 @@ kubectl get elasticsearchautoscaler.autoscaling.k8s.elastic.co/autoscaling-sampl
273
277
```
274
278
275
279
276
-
### Events [k8s-events]
280
+
#### Events [k8s-events]
277
281
278
282
Important events are also reported through Kubernetes events, for example when the maximum autoscaling size limit is reached:
279
283
@@ -284,7 +288,7 @@ Important events are also reported through Kubernetes events, for example when t
284
288
```
285
289
286
290
287
-
## Disable autoscaling [k8s-disable]
291
+
### Disable autoscaling [k8s-disable]
288
292
289
293
You can disable autoscaling at any time by deleting the `ElasticsearchAutoscaler` resource. For machine learning the following settings are not automatically reset:
290
294
@@ -294,3 +298,50 @@ You can disable autoscaling at any time by deleting the `ElasticsearchAutoscaler
294
298
295
299
You should adjust those settings manually to match the size of your deployment when you disable autoscaling.
296
300
301
+
## Autoscaling stateless applications on ECK [k8s-stateless-autoscaling]
302
+
303
+
::::{note}
304
+
This section only applies to stateless applications. Check [Elasticsearch autoscaling](#k8s-autoscaling) for more details about scaling automatically Elasticsearch.
305
+
::::
306
+
307
+
308
+
The [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale) can be used to automatically scale the deployments of the following resources:
309
+
310
+
* Kibana
311
+
* APM Server
312
+
* Elastic Maps Server
313
+
314
+
These resources expose the `scale` subresource which can be used by the Horizontal Pod Autoscaler controller to automatically adjust the number of replicas according to the CPU load or any other custom or external metric. This example shows how to create an `HorizontalPodAutoscaler` resource to adjust the replicas of a Kibana deployment according to the CPU load:
*[Autoscaling stateless applications](../../autoscaling/autoscaling-stateless-applications-on-eck.md): Use [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) for {{kib}} or other stateless applications.
32
+
*[Autoscaling stateless applications](../../autoscaling/autoscaling-in-eck.md#k8s-stateless-autoscaling): Use [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) for {{kib}} or other stateless applications.
0 commit comments