Kahibaro
Discord Login Register

Vertical scaling

Concept of Vertical Scaling in OpenShift

Vertical scaling in OpenShift means changing the resources available to a pod (and therefore its containers), rather than changing the number of pod replicas. Instead of adding more pods, you give more CPU, memory, or other resources to the existing pods.

In Kubernetes/OpenShift terms, this is about adjusting:

Vertical scaling is especially relevant for:

Horizontal Pod Autoscaling (HPA) and cluster-autoscaling focus on more pods and more nodes; vertical scaling focuses on bigger pods.

Resource Requests and Limits

Vertical scaling is implemented primarily by adjusting CPU and memory requests/limits in pod specs (via Deployment, StatefulSet, DeploymentConfig, etc.).

Example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: example-app
spec:
  replicas: 1
  template:
    spec:
      containers:
      - name: app
        image: myorg/example:latest
        resources:
          requests:
            cpu: "250m"
            memory: "512Mi"
          limits:
            cpu: "2"
            memory: "4Gi"

Typical vertical scaling actions:

Implications:

Manual Vertical Scaling Workflow

Vertical scaling can be done manually by editing the workload spec and letting OpenShift roll out new pods.

Typical workflow:

  1. Observe metrics:
    • Pod CPU usage, throttling, memory usage, OOM kills.
  2. Update the workload definition:
    • oc edit deployment my-app or
    • oc set resources deployment/my-app --limits=cpu=2,memory=4Gi --requests=cpu=1,memory=2Gi
  3. Apply new configuration:
    • OpenShift triggers a rollout (new pods with new resources).
  4. Verify:
    • oc get pods to see new pods.
    • Re-check metrics to ensure the new size is sufficient.

Example with oc:

# Increase CPU and memory for a deployment
oc set resources deployment/my-app \
  --requests=cpu=500m,memory=1Gi \
  --limits=cpu=2,memory=4Gi

Manual scaling is simple but:

Vertical Pod Autoscaling Concepts

Kubernetes has the concept of Vertical Pod Autoscaling (VPA), and similar functionality can be used within OpenShift depending on version, installed Operators, or custom tooling.

The idea:

Typical VPA components (conceptual):

Modes you may encounter:

Use cases:

Trade-offs:

Vertical Scaling and Scheduling

Vertical scaling affects how pods fit onto nodes:

Considerations:

In OpenShift clusters with cluster autoscaling, vertical scaling can:

Vertical vs Horizontal Scaling in OpenShift

Vertical scaling and horizontal scaling often complement each other.

Typical patterns:

When vertical scaling is more appropriate:

When horizontal scaling is preferred:

In some scenarios, you may need both:

Vertical Scaling Strategies and Best Practices

Start with requests, not limits

Use data, not guesses

Base vertical scaling decisions on:

Example steps:

  1. Observe pods running at >80% memory with occasional OOMKilled events.
  2. Increase memory request/limit by a small factor (e.g. +25–50%).
  3. Watch for stability over several peak cycles.

Beware of JVM and managed runtimes

Java, .NET, and other managed runtimes may:

For these workloads, vertical scaling is tightly coupled with runtime tuning.

Plan for restarts

Changing pod resources typically implies recreating pods:

Interactions with quotas and limits

Projects/namespaces may have:

When vertically scaling:

Typical Vertical Scaling Scenarios in OpenShift

Scenario 1: Single-pod legacy application

Scenario 2: Memory-heavy analytics job

Scenario 3: Bursty but low-concurrency workload

Summary

Vertical scaling in OpenShift focuses on changing pod size (CPU/memory) instead of pod count. It relies on careful configuration of requests and limits, observation of real resource usage, and understanding of scheduling and application behavior.

When used thoughtfully and often in combination with horizontal scaling, vertical scaling helps:

Views: 24

Comments

Please login to add a comment.

Don't have an account? Register now!