cancel
Showing results for 
Search instead for 
Did you mean: 
Chetan_Tiwary_
Community Manager
Community Manager
  • 818 Views

Explain Openshift resource manifest

Explain this openshift resource manifest

 

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: hpa-resource-metrics-memory
  namespace: default
spec:
...
  minReplicas: 20
...
  behavior:
    scaleDown:
      stabilizationWindowSeconds: 300
      policies:
      - type: Pods
        value: 4
        periodSeconds: 30
      - type: Percent
        value: 10
        periodSeconds: 60
      selectPolicy: Max
    scaleUp:
      selectPolicy: Disabled
Labels (4)
Tags (1)
17 Replies
Mr_Atoz
Cadet
Cadet
  • 124 Views

A few items of note:

* The v2beta2 API version is years out of date, removed in k8s 1.26 in 2022.

* Scale Up is disabled, it only has a scale down policy; not a great use of HPA in my opinion.  The minimum here can be overridden by manual scaling, so if the deployment was scaled below the min, HPA would not be able to scale it back up.

* minReplicas is 20, meaning there will always be at least 20 pods running.  Seems high for a minimum to me, but we're not given a workload profile so it is unknown.

* 300 seconds of "stable" behavior must be observed before the HPA would be triggered

* scales down by up to 10% of pods every 60 seconds or up to 4 pods every 30 seconds

 

 

  • 288 Views

This OpenShift Horizontal Pod Autoscaler (HPA) manifest automatically adjusts the number of pod replicas based on resource metrics like memory usage.

Explanation:

  • apiVersion: Specifies the HPA API version (autoscaling/v2beta2), which supports advanced scaling policies.
  • kind: Defines the resource type as HorizontalPodAutoscaler.
  • metadata: Contains metadata such as the HPA name and namespace.
  • minReplicas: Sets the minimum number of pods to 20 (the cluster will never scale below this number).
  • behavior: Controls how the HPA scales pods:

Scale Down Policy:

  • stabilizationWindowSeconds: Waits 300 seconds (5 minutes) before scaling down to avoid frequent fluctuations.
  • policies: Defines two methods for scaling down:
    • Pods Type: Remove up to 4 pods every 30 seconds.
    • Percent Type: Remove 10% of pods every 60 seconds.
  • selectPolicy: Chooses the Max policy, meaning the most aggressive scaling policy will be applied.

Scale Up Policy:

  • selectPolicy: Set to Disabled, which means pods will not scale up automatically.

    Summary
    This HPA automatically scales down pods based on memory usage, with a minimum of 20 pods. It removes pods gradually to avoid sudden changes, prioritizing the fastest possible scale-down method. Scaling up is completely disabled.
afordona
Cadet
Cadet
  • 260 Views

Summary of the OpenShift manifest for the HorizontalPodAutoscaler (HPA):

Minimum Replicas: Ensures at least 20 pod replicas are maintained.
Scale Down Behavior:
Stabilization window of 300 seconds.
Policies to scale down by a maximum of 4 pods every 30 seconds or 10% every 60 seconds.
Uses the policy with the maximum value.
Scale Up Behavior: Scaling up is disabled,

Asma-Alfayyad
Mission Specialist
Mission Specialist
  • 240 Views

This manifest defines a HorizontalPodAutoscaler to automatically scale the number of pod replicas based on resource usage, in this case, memory.

  • The HorizontalPodAutoscaler ensures at least 20 replicas are running at all times.
  • When scaling down, it allows reductions of up to 4 pods in 30 seconds and 10% of the total pods in 1 minute, but it won’t scale down too quickly (due to the 5-minute stabilization window).
  • Scaling up is disabled in this configuration, meaning the system won't automatically add more pods based on memory usage.
abhidd
Mission Specialist
Mission Specialist
  • 198 Views

a HorizontalPodAutoscaler (HPA) resource that automatically adjusts the number of replicas for a deployment based on certain conditions

minReplicas: 20: Ensures that there are always at least 20 replicas running.

Scale Down Behavior: Allows the HPA to reduce the number of pods based on two policies (pods and percentage), with a stabilization window of 5 minutes to avoid too rapid scaling down.

Scale Up Behavior: No scaling up is allowed as the selectPolicy is set to Disabled.

  • 160 Views

This OpenShift resource manifest defines a HorizontalPodAutoscaler (HPA) configuration that uses memory-related metrics to scale an application’s pods. Let me break it down:

1. apiVersion: autoscaling/v2beta2:

Specifies the API version being used. v2beta2 is used here, which supports more advanced features like scaling policies and custom metrics.

2. kind: HorizontalPodAutoscaler:

Indicates that this resource is an HPA, responsible for automatically scaling the number of pods in a deployment based on specified metrics or thresholds.

3. metadata:

name: hpa-resource-metrics-memory: This is the name of the HPA object.

namespace: default: Specifies that the HPA is applied in the default namespace.

4. spec:

minReplicas: 20: Sets the minimum number of pods to maintain, ensuring that scaling down does not reduce the pod count below 20.

Additional details about scaling policies and behaviors are defined under the behavior section.

5. behavior: The behavior section customizes how scaling up or down is handled.

scaleDown:

    #stabilizationWindowSeconds: 300: Introduces a 5-minute stabilization window. This means the HPA won’t reduce the number of pods if the load changes within this time frame.

    #policies:

        ##type: Pods, value: 4, periodSeconds: 30: Limits the scale-down rate to a maximum of 4 pods every 30 seconds.

        ##type: Percent, value: 10, periodSeconds: 60: Limits scale-down to 10% of the current pod count every 60 seconds.

    #selectPolicy: Max: Indicates that the most restrictive policy (maximum decrease allowed) will be enforced when multiple policies overlap.

scaleUp:

    #selectPolicy: Disabled: Scaling up is effectively disabled. This prevents the HPA from increasing the number of pods.

 

This HPA configuration is designed to:

  • Maintain at least 20 pods (minReplicas: 20).

  • Allow controlled and gradual scaling down of pods with policies based on both absolute counts (Pods) and percentage-based thresholds (Percent).

  • Disable any scaling up altogether (scaleUp.selectPolicy: Disabled).

This setup might be intended for a highly sensitive or resource-intensive application where aggressive scaling needs to be avoided.

Gopinath_Pigili
Flight Engineer
Flight Engineer
  • 143 Views

This OpenShift resource manifest defines a Horizontal Pod Autoscaler (HPA) named "hpa-resource-metrics-memory" in the "default" namespace, ensuring at least 20 pods are running, and implements a scale-down policy with a 5-minute stabilization window, prioritizing the policy that allows the largest number of pods to be removed, while disabling scale-up.

Thanks

Gopinath

ArtemCC
Cadet
Cadet
  • 46 Views

This file sets up a system in Kubernetes to automatically adjust the number of running pods based on memory usage. It ensures there are always at least 20 pods running.

The system can reduce the number of pods slowly, but it won't increase the number of pods.

0 Kudos
Join the discussion
You must log in to join this conversation.