Skip to content

Commit

Permalink
feat: configuring number of replicas (#2676)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
tolusha and deerskindoll authored Feb 14, 2024
1 parent fbfd367 commit da474ae
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/administration-guide/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
** xref:configuring-server-components.adoc[]
*** xref:mounting-a-secret-as-a-file-or-an-environment-variable-into-a-container.adoc[]
*** xref:advanced-configuration-options-for-the-che-server-component.adoc[]
*** xref:configuring-number-of-replicas.adoc[]
** xref:configuring-workspaces-globally.adoc[]
*** xref:limiting-the-number-of-workspaces-that-a-user-can-keep.adoc[]
*** xref:enabling-users-to-run-multiple-workspaces-simultaneously.adoc[]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:_content-type: ASSEMBLY
:description: Configuring number of replicas for a {prod} container
:keywords: administration guide, configuring-number-of-replicas
:navtitle: Configuring number of replicas for a {prod} container
:page-aliases:

[id="configuring-number-of-replicas"]

include::partial$proc_configuring-number-of-replicas.adoc[leveloffset=+1]

Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
= Configuring server components

* xref:mounting-a-secret-as-a-file-or-an-environment-variable-into-a-container.adoc[]
* xref:advanced-configuration-options-for-the-che-server-component.adoc[]
* xref:configuring-number-of-replicas.adoc[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
:_content-type: PROCEDURE
:description: Configuring a number of replicas
:keywords: administration-guide, configuring-number-of-replicas
:navtitle: Configuring a number of replicas {prod-cli}
:page-aliases:

[id="configuring-number-of-replicas"]
= Configuring the number of replicas

To configure the number of replicas for {prod-short} operands using {kubernetes} `HorizontalPodAutoscaler`
(HPA), you can define an `HPA` resource for deployment. The `HPA` dynamically adjusts the number
of replicas based on specified metrics.

.Procedure

. Create an `HPA` resource for a deployment, specifying the target metrics and desired replica count.
+
[source,yaml,subs="+attributes,+quotes"]
----
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: scaler
namespace: {prod-namespace}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: __<deployment_name>__ <1>
...
----
<1> The `__<deployment_name>__` corresponds to the one following deployments:
* `{prod-deployment}`
* `che-gateway`
* `{prod-deployment}-dashboard`
* `plugin-registry`
* `devfile-registry`

.Create a `HorizontalPodAutoscaler` for {prod-deployment} deployment:
====
[source,yaml,subs="+attributes,+quotes"]
----
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {prod-deployment}-scaler
namespace: {prod-namespace}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {prod-deployment}
minReplicas: 2
maxReplicas: 5
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
----
In this example, the HPA is targeting the Deployment named {prod-deployment}, with a minimum of 2 replicas, a maximum of 5 replicas
and scaling based on CPU utilization.
====

.Additional resources
* link:https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale[Horizontal Pod Autoscaling]

0 comments on commit da474ae

Please sign in to comment.