cancel
Showing results for 
Search instead for 
Did you mean: 
Chetan_Tiwary_
Community Manager
Community Manager
  • 292 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)
9 Replies
Kent-Kamau
Mission Specialist
Mission Specialist
  • 130 Views

The provided resource manifest is for a HorizontalPodAutoscaler (HPA) which automatically scales the number of pods in a deployment or replica set based on observed resource usage or other metrics.

This HorizontalPodAutoscaler is set to:

  1. Minimum Replicas: Always maintain at least 20 pods.
  2. Scale Down Behavior: After scaling down, wait for 5 minutes before considering another scale-down event.
  3. Limit scale-down actions to a maximum of 4 pods within 30 seconds or 10% of the total pods within 60 seconds, whichever is greater.
  4. The Max scaling policy ensures that the largest scale-down value will be applied.
  5. Scale Up Behavior: Scaling up is disabled for this HPA, meaning no new pods will be added even if resource usage increases.
  • 128 Views

This configuration helps manage the number of replicas in response to changing workload demands while preventing rapid scaling oscillations.
Minimum 20 replicas running, scalling down is gradually with 10% cut down every minute or 4 pods every 30 seconds, which ever is bigger.
Scaling up targeting utilization without specific policy. 

mcapileibm
Mission Specialist
Mission Specialist
  • 108 Views

HorizontalPodAutoscaler (HPA) in OpenShift manages pod scaling based on % resource usage.
ensures at least 20 pods are always running (minReplicas: 20).
Scaling down : It can remove up to 4 pods every 30 seconds or 10% of pods every 60 seconds.
Scaling up is disabled, meaning new pods won’t be added automatically.

walid-cnj
Cadet
Cadet
  • 100 Views

Is that an old manifest?   The latest stable version of the Horizontal Pod Autoscaler (HPA) API is:  apiVersion: autoscaling/v2 was introduced in Kubernetes 1.23, that is OpenShift 4.10 and became stable(GA) in Kubernetes 1.26, OpenShift 4.13, latest Openshift release as I am writing as of March 2025 is 4.17 with kubernetes 1.30 to give you perspective how outdated the API version is.

Other than what others already said, I present my concerns, what is not there instead of what is there!!

Some Concerns:
1- With scaling up disabled, the system can't automatically handle increased load
   scaleUp:  selectPolicy: Disabled

2- The minimum of 20 replicas might be resource-intensive if not needed, haven't seen it in my 6+ years of K8s operations?!

3- The 5-minute stabilization window might be too long for most workloads

4- Having two scale-down policies introduces confusion as well might lead to aggressive scaling in some scenarios

Thoughts:

Update to the right/latest API version for HPA.

Doesn't want automatic scaling up (possibly handled by other mechanisms?!)
Needs careful, controlled scaling down?!
Requires high availability (minimum 20 pods)?!

  • 84 Views

Its horizontal pod autosacalling configuration file which has details given below:
setting the repicas minimum to 20 

setting the scalling behaviour for scaling down by 4 pod (10%) every 30 seconds with stability of 5 minuts.
its not gona scale up as per this configuration

0 Kudos
pramod188
Cadet
Cadet
  • 61 Views

- This HPA creates the scaledown policy,
- This HPA maintains 20 minimum replicas. Even if load decreases, openshift will not scale below 20.
- The first policy (Pods) allows at most 4 replicas to be scaled down in 30 seconds. The second policy (Percent) allows atmost 10 percent of
the current replicas to be scaled down in 60 seconds. This will repart in each iterations.

- In this example there are two policies defined and it specifies Policy to `selectPolicy: Max`    The Max policy allows the highest amount of change. For lowest amount of the chnage Min can be used.

- The default value for Policy is Max.

0 Kudos
Psehgaf
Flight Engineer
Flight Engineer
  • 43 Views

  1. Defines a HorizontalPodAutoscaler (HPA) to manage pod scaling
  2. The HPA name is hpa-resource-metrics-memory.
  3. It is placed in the default namespace.
  4. minReplicas: 20 = Ensures at least 20 pods are running, even if load decreases.
    (Max replicas are not specified, so default behavior applies.)
  5. stabilizationWindowSeconds: 300
    1. Avoids rapid scale-downs by ensuring a 5-minute stabilization period.
  6. policies:
    1. Pods-based scaling: Remove up to 4 pods every 30 seconds.
      Percentage-based scaling: Reduce by 10% of total pods every 60 seconds.
  7. selectPolicy: Max
    1. Uses the policy with the highest allowed reduction (either 4 pods or 10%).

Minimum of 20 pods are always running.
Scaling down can happen gradually (4 pods per 30 sec OR 10% per 60 sec).
Scaling up is disabled, meaning new pods won't be added automatically.

• ╚╬╦╬Psehgaft╬╦╬╝ ◦
0 Kudos
Manlio
Mission Specialist
Mission Specialist
  • 30 Views

Yo, we ain't using that legacy v1 stuff. We're on the cutting edge with v2beta2, the real deal for resource-based autoscaling. This ain't your grandma's HPA.

We're summoning the mighty HPA! This ain't no Deployment, it's the auto-scaling overlord. We're telling Kubernetes to flex those pod muscles.

We're dubbing this beast 'hpa-resource-metrics-memory' and dumping it in the 'default' namespace. Keep your namespaces tidy, folks. We ain't running a wild cluster.

We're starting with a solid 20 pods. No wimpy deployments here. We're building a fortress of containers. This application means business.

When the load drops, we're not gonna panic and shrink immediately. We're gonna chill for 300 seconds (5 minutes) before we even think about scaling down. No jittery scaling, we're keeping it smooth and stable.

For the scale-down, we're taking it easy. We're only dropping 4 pods every 30 seconds. No sudden pod deletions, we're being gentle. If we're feeling a bit more aggressive, we'll scale down by 10% every 60 seconds. We're giving the system some flexibility.

When it comes to scaling down, we're going all in. We're picking the most aggressive policy. Max it out! We want to shrink fast when we need to.

Hold your horses! Scaling up? Nah, we're disabling that. We're only focused on scaling down in this scenario. We're keeping a tight rein on resource usage. Scale up? Not today, buddy

This HPA is all about scaling down. It's designed to be conservative with resources, ensuring that the application doesn't hog more than it needs. The minimum replica count is 20, and the scale-down behavior is carefully controlled to prevent sudden changes. Scaling up is completely disabled. This is a very specific HPA configuration for a workload that needs to be scaled down, but never scaled up.

 

0 Kudos
fefe19
Mission Specialist
Mission Specialist
  • 13 Views

This is an OpenShift HorizontalPodAutoscaler (HPA) resource manifest that automatically scales the number of pods in a deployment based on resource utilization.

Breakdown of the Manifest

API Version and Kind

apiVersion: autoscaling/v2beta2 – Specifies the Kubernetes API version for HPA. This version supports advanced scaling policies.
kind: HorizontalPodAutoscaler – Defines the resource type as an HPA.

Metadata

metadata:
    name: hpa-resource-metrics-memory – The name of the HPA object.
    namespace: default – The namespace where this HPA is applied.

Specification (spec)

This section defines the scaling behavior.

minReplicas: 20 – The minimum number of pod replicas must always be 20. Even if resource usage is low, the deployment will not scale below this number.

Scaling Behavior (behavior)

This section defines how the HPA scales pods up or down.

Scale Down (scaleDown)

stabilizationWindowSeconds: 300 – The system waits 300 seconds (5 minutes) before scaling down to prevent rapid fluctuations.

policies: – Defines scaling policies for decreasing the number of pods:

- type: Pods, value: 4, periodSeconds: 30 – Reduces up to 4 pods every 30 seconds.

- type: Percent, value: 10, periodSeconds: 60 – Reduces up to 10% of the total pod count every 60 seconds.

selectPolicy: Max – Uses the most aggressive scaling policy, meaning the largest reduction allowed by the policies is chosen.

Scale Up (scaleUp)

selectPolicy: Disabled – Scaling up is disabled, meaning the number of pods cannot increase beyond the current count.

Summary

This HPA ensures that at least 20 pods are always running, allows controlled scale-down by removing a maximum of 4 pods every 30s or 10% every 60s, and completely disables scaling up.

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