Skip to content

Commit da474ae

Browse files
feat: configuring number of replicas (#2676)
* feat: configuring number of replicas Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Update modules/administration-guide/partials/proc_configuring-number-of-replicas.adoc Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com> --------- Signed-off-by: Anatolii Bazko <abazko@redhat.com> Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com>
1 parent fbfd367 commit da474ae

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

modules/administration-guide/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
** xref:configuring-server-components.adoc[]
3737
*** xref:mounting-a-secret-as-a-file-or-an-environment-variable-into-a-container.adoc[]
3838
*** xref:advanced-configuration-options-for-the-che-server-component.adoc[]
39+
*** xref:configuring-number-of-replicas.adoc[]
3940
** xref:configuring-workspaces-globally.adoc[]
4041
*** xref:limiting-the-number-of-workspaces-that-a-user-can-keep.adoc[]
4142
*** xref:enabling-users-to-run-multiple-workspaces-simultaneously.adoc[]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:_content-type: ASSEMBLY
2+
:description: Configuring number of replicas for a {prod} container
3+
:keywords: administration guide, configuring-number-of-replicas
4+
:navtitle: Configuring number of replicas for a {prod} container
5+
:page-aliases:
6+
7+
[id="configuring-number-of-replicas"]
8+
9+
include::partial$proc_configuring-number-of-replicas.adoc[leveloffset=+1]
10+

modules/administration-guide/pages/configuring-server-components.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
= Configuring server components
99

1010
* xref:mounting-a-secret-as-a-file-or-an-environment-variable-into-a-container.adoc[]
11+
* xref:advanced-configuration-options-for-the-che-server-component.adoc[]
12+
* xref:configuring-number-of-replicas.adoc[]
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
:_content-type: PROCEDURE
2+
:description: Configuring a number of replicas
3+
:keywords: administration-guide, configuring-number-of-replicas
4+
:navtitle: Configuring a number of replicas {prod-cli}
5+
:page-aliases:
6+
7+
[id="configuring-number-of-replicas"]
8+
= Configuring the number of replicas
9+
10+
To configure the number of replicas for {prod-short} operands using {kubernetes} `HorizontalPodAutoscaler`
11+
(HPA), you can define an `HPA` resource for deployment. The `HPA` dynamically adjusts the number
12+
of replicas based on specified metrics.
13+
14+
.Procedure
15+
16+
. Create an `HPA` resource for a deployment, specifying the target metrics and desired replica count.
17+
+
18+
[source,yaml,subs="+attributes,+quotes"]
19+
----
20+
apiVersion: autoscaling/v2
21+
kind: HorizontalPodAutoscaler
22+
metadata:
23+
name: scaler
24+
namespace: {prod-namespace}
25+
spec:
26+
scaleTargetRef:
27+
apiVersion: apps/v1
28+
kind: Deployment
29+
name: __<deployment_name>__ <1>
30+
...
31+
----
32+
<1> The `__<deployment_name>__` corresponds to the one following deployments:
33+
* `{prod-deployment}`
34+
* `che-gateway`
35+
* `{prod-deployment}-dashboard`
36+
* `plugin-registry`
37+
* `devfile-registry`
38+
39+
.Create a `HorizontalPodAutoscaler` for {prod-deployment} deployment:
40+
====
41+
[source,yaml,subs="+attributes,+quotes"]
42+
----
43+
apiVersion: autoscaling/v2
44+
kind: HorizontalPodAutoscaler
45+
metadata:
46+
name: {prod-deployment}-scaler
47+
namespace: {prod-namespace}
48+
spec:
49+
scaleTargetRef:
50+
apiVersion: apps/v1
51+
kind: Deployment
52+
name: {prod-deployment}
53+
minReplicas: 2
54+
maxReplicas: 5
55+
metrics:
56+
- type: Resource
57+
resource:
58+
name: cpu
59+
target:
60+
type: Utilization
61+
averageUtilization: 75
62+
----
63+
In this example, the HPA is targeting the Deployment named {prod-deployment}, with a minimum of 2 replicas, a maximum of 5 replicas
64+
and scaling based on CPU utilization.
65+
====
66+
67+
.Additional resources
68+
* link:https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale[Horizontal Pod Autoscaling]

0 commit comments

Comments
 (0)