cancel
Showing results for 
Search instead for 
Did you mean: 
Chetan_Tiwary_
Community Manager
Community Manager
  • 1,081 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)
19 Replies
Mr_Atoz
Cadet
Cadet
  • 281 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

 

 

  • 445 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
  • 417 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
  • 397 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
Flight Engineer
Flight Engineer
  • 355 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.

  • 317 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
  • 300 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
Mission Specialist
Mission Specialist
  • 203 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.

  • 119 Views

This manifest defines a HorizontalPodAutoscaler (HPA) for managing the scaling of pods based on resource metrics, specifically memory usage.

Key Sections

  1. apiVersion: Specifies the version of the API used (autoscaling/v2beta2).
  2. kind: Indicates the type of resource (HorizontalPodAutoscaler).
  3. metadata: Contains metadata about the HPA, including:
    • name: The name of the HPA (hpa-resource-metrics-memory).
    • namespace: The namespace where the HPA is deployed (default).

Spec

The spec section defines the behavior and rules for scaling:

  1. minReplicas: Sets the minimum number of pod replicas to 20. This means there will always be at least 20 pods running.

  2. behavior: Defines how the HPA should scale pods:

    • scaleDown: Rules for reducing the number of pods:
      • stabilizationWindowSeconds: Waits 300 seconds (5 minutes) before scaling down to avoid rapid fluctuations.
      • policies:
      • type: Pods: Reduces the number of pods by 4 every 30 seconds.
      • type: Percent: Reduces the number of pods by 10% every 60 seconds.
      • selectPolicy: Uses the maximum value from the policies to decide how many pods to scale down.
    • scaleUp: Rules for increasing the number of pods:
      • selectPolicy: Scaling up is disabled, meaning the HPA won't automatically increase the number of pods.

Summary

This HPA ensures that there are always at least 20 pods running and defines specific rules for scaling down the number of pods based on memory usage. Scaling up is disabled in this configuration.

  • 39 Views

The HorizontalPodAutoscaler (HPA) in OpenShift manages pod scaling based on memory usage. It ensures that at least 20 pods are always running (minReplicas: 20). Scaling down is controlled with a 300-second stabilization window, meaning it waits before reducing pods. It can remove up to 4 pods every 30 seconds or 10% of pods every 60 seconds, applying the more aggressive policy (selectpolicy:Max). Scaling up is disabled (selectpolicy: Disabled), meaning new pods won’t be added automatically, even if resource usage increases.

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