KAHIBARO Bookshelves
Discord Login Register

16.5. Capacity planning

Key Goals of Capacity Planning in OpenShift

Capacity planning in OpenShift is about ensuring that your cluster has enough compute, memory, storage, and network resources to meet current and future demands—without excessive over‑provisioning. In the context of operations, it connects:

  • Workload requirements (applications, CI/CD pipelines, batch jobs)
  • Platform overhead (control plane, Operators, monitoring, logging, registry)
  • Service-level objectives (SLOs) (availability, latency, throughput, time‑to‑scale)

In practice, capacity planning in OpenShift is iterative and data-driven, not a one‑time sizing exercise.

Key objectives:

  • Avoid resource saturation that leads to pod evictions, throttling, and failures.
  • Provide headroom for spikes, upgrades, and node failures.
  • Balance cost efficiency with reliability and performance.
  • Align infrastructure growth with application and business growth.

Capacity Planning Dimensions in OpenShift

Capacity must be considered across several dimensions that interplay with each other.

Compute (CPU and Memory)

  • Node sizing: Fewer large nodes vs more smaller nodes impacts:
    • Failure blast radius (how much workload is lost when one node fails)
    • Scheduling flexibility (bin-packing pods with different resource profiles)
  • CPU vs memory ratio:
    • Some clusters are CPU‑bound (e.g., API processing, microservices)
    • Others are memory‑bound (e.g., caching, in‑memory analytics)
  • Headroom:
    • Always reserve some percentage of aggregate CPU/memory for:
      • Control plane and system daemons
      • Spikes and rescheduling during failures
      • Upgrades and rolling node maintenance
    • A common operational starting point is to target ~60–70% sustained utilization at peak.

Storage

  • Capacity: Sizing total storage across:
    • Application data volumes
    • Internal registry
    • Logging and metrics storage
    • Backup and snapshot space
  • Performance:
    • IOPS and throughput needs for workloads (databases, message queues)
    • Latency requirements for stateful services
  • Classes of storage:
    • Multiple StorageClass types with different performance and cost tiers
    • Plan which workloads can use lower‑tier vs high‑performance storage

Network and Ingress

  • Bandwidth and throughput:
    • North–south: client traffic through Routes/Ingress/Load Balancers
    • East–west: service‑to‑service traffic within the cluster
  • Ingress capacity:
    • Number and size of router/ingress pods
    • External load balancer limits (connections, throughput)
  • Multi‑zone routing and failover:
    • Ensuring enough ingress capacity in each zone
    • Planning for zone failure scenarios

High Availability and Failure Scenarios

Capacity must be sufficient not just for normal operation, but also under failure:

  • Node failure: Can the remaining nodes run all critical pods when one or more nodes are lost?
  • Zone failure:
    • Are replicas and capacities distributed across availability zones?
    • Is there enough spare capacity in surviving zones?
  • Upgrade and maintenance windows:
    • During rolling node upgrades, workloads are temporarily moved.
    • Plan capacity so nodes can be drained without overloading others.

Inputs for Capacity Planning

Effective capacity planning combines design assumptions with real utilization data.

Workload Profiles

Gather or estimate:

  • Number of applications and replicas
  • Resource requests and limits per pod:
    • CPU (cores or millicores) and memory
    • Patterns of over‑ or under‑requesting
  • Traffic patterns:
    • Average vs peak RPS (requests per second)
    • Daily/weekly seasonality
    • Batch vs interactive traffic
  • Growth expectations:
    • Planned new services
    • Expected user growth and data growth
    • Upcoming campaigns, releases, or events

Platform Overhead and Operators

Account for:

  • Control plane components (API servers, controllers, etcd)
  • Core platform services:
    • Ingress/routers
    • Cluster DNS
    • Monitoring and logging stack
    • Internal image registry (if used)
  • Third‑party and custom Operators:
    • Each Operator may run multiple controllers and operand pods.
    • Some Operators manage resource‑heavy services (DBs, caches, message brokers).

Platform overhead typically ranges from a few percent to 20–30% of cluster resources, depending on how many platform services are hosted inside the cluster.

SLOs and Business Constraints

Tie capacity to non‑technical constraints:

  • Target availability (e.g., 99.9% vs 99.99%) affects redundancy requirements.
  • Performance SLOs (latency, throughput) influence how much headroom you maintain.
  • Budget and cost constraints define upper bounds on node counts and instance types.
  • Compliance may require data separation (e.g., separate nodes/regions), impacting utilization.

Estimating Cluster Size

A structured estimation process helps you move from requirements to an initial cluster design. You refine it later using monitoring data.

Step 1: Normalize Application Requirements

For each workload, consider its steady‑state resource requests (not limits), then add some buffer.

Example for CPU:

$$
\text{Total\_CPU\_requests} = \sum_{i=1}^{N} (\text{CPU\_request\_per\_pod\_} i \times \text{replicas\_} i)
$$

Do the same for memory. Then add a headroom factor, e.g., 30%:

$$
\text{Total\_CPU\_with\_buffer} = \text{Total\_CPU\_requests} \times 1.3
$$

Repeat for memory. Make sure to separate:

  • Critical workloads (must always run under failure)
  • Best‑effort or batch workloads (can be throttled or paused)

Step 2: Add Platform and System Overhead

Estimate capacity reserved for:

  • System daemons and kubelets
  • OpenShift core services
  • Monitoring, logging, and Operators

You can model this as a flat baseline (e.g., X cores and Y GB per node) or as a percentage of total node resources. For planning, you might assume something like:

$$
\text{Usable\_node\_CPU} = \text{Node\_CPU\_total} \times 0.8
$$

leaving 20% for overhead and spikes. Adjust based on your environment.

Step 3: Derive Node Count and Types

Given a node type with certain capacity, e.g.:

  • $C_{\text{node}}$: CPU cores per node
  • $M_{\text{node}}$: memory per node

And given usable fractions $f_{\text{CPU}}$ and $f_{\text{Mem}}$, your effective per‑node capacity is:

$$
C_{\text{usable}} = C_{\text{node}} \times f_{\text{CPU}}
$$
$$
M_{\text{usable}} = M_{\text{node}} \times f_{\text{Mem}}
$$

Then:

$$
\text{Node\_count\_CPU} = \left\lceil \frac{\text{Total\_CPU\_with\_buffer}}{C_{\text{usable}}} \right\rceil
$$
$$
\text{Node\_count\_Mem} = \left\lceil \frac{\text{Total\_Mem\_with\_buffer}}{M_{\text{usable}}} \right\rceil
$$

Take the maximum of the two as a starting node count.

Next, apply HA and failure constraints. For example, in an N+1 scheme:

  • Ensure that after losing one node, the remaining nodes still have enough capacity for all critical workloads.
  • This may require an additional node or more headroom.

If using multiple availability zones, perform this sizing per zone.

Step 4: Consider Multiple Node Pools and Special Hardware

Plan distinct machine sets / node pools for:

  • General purpose workloads
  • Compute‑optimized or memory‑optimized workloads
  • Specialized nodes:
    • GPU nodes for ML/AI or HPC
    • Storage‑heavy nodes for data services

Each pool can be sized independently, based on the subset of workloads that may land on that pool, and governed by labels and nodeSelector/affinity rules.

Using Quotas, Requests, and Limits for Capacity Management

Capacity planning is only effective when you control how workloads consume cluster resources.

Enforcing Resource Requests

  • The scheduler uses requests, not limits, to decide placement.
  • Encourage or enforce realistic requests via:
    • Default LimitRange for namespaces
    • Admission policies that reject pods without requests
  • Under‑requested workloads can cause noisy neighbor problems and unpredictable performance.

Namespaces, Quotas, and Fair Sharing

Use ResourceQuota and LimitRange to align tenant expectations with cluster capacity:

  • Set per‑project caps for:
    • Total CPU/memory requests and limits
    • Number of pods
    • PersistentVolumeClaims
  • Reserve capacity for critical namespaces and platform services.
  • Prevent a single team from consuming all available resources.

Pod Disruption and Node Drains

During maintenance and failures, pods are rescheduled:

  • Ensure enough spare capacity so that when nodes are drained (for upgrades or repairs), other nodes can absorb their workloads.
  • Use Pod Disruption Budgets (PDBs) to control how many replicas can be unavailable but recognize that PDBs require sufficient capacity to be effective.

Storage Capacity Planning

Storage is often a bottleneck if not planned carefully.

Sizing for Application and Platform Data

Identify and estimate:

  • Persistent Volumes (PVs) for application data:
    • Current usage and expected growth (per month/quarter)
  • Metrics and logging:
    • Retention period (e.g., 7 days vs 30 days) has a huge impact on storage.
    • Sampling rate and cardinality (number of metrics/labels).
  • Registry data:
    • Number and size of images
    • Image retention policies (pruning strategy)

Plan total capacity as:

$$
\text{Total\_storage} = \text{App\_data} + \text{Logs\_and\_metrics} + \text{Registry} + \text{Backups\_and\_snapshots} + \text{Buffer}
$$

Performance Classes and Workload Mapping

Assign workloads to appropriate StorageClass types:

  • High IOPS/low latency for databases and message brokers.
  • Standard performance for typical stateless services with occasional persistence.
  • Lower‑tier or object storage for logs, archives, and backups.

Map expected IOPS and throughput to the underlying storage system’s capabilities, ensuring:

  • You stay within provider or array limits.
  • You understand how many volumes per node and per workload you can support.

Network and Ingress Capacity

Network planning focuses on bandwidth, latency, and connection limits.

Ingress and Router Scaling

Consider:

  • Peak external request rate and bandwidth across all Routes/Ingress.
  • Number of router/ingress pods and their resource requests.
  • How routers are spread across nodes and zones.

To scale:

  • Use horizontal scaling (more router pods) rather than overly large single pods.
  • Use multiple ingress controllers (e.g., internal vs external traffic) with distinct capacity plans.

East–West Traffic and Service Mesh

If using a service mesh or heavy inter‑service traffic:

  • Account for sidecar overhead (CPU/memory) on each pod.
  • Consider additional network latency and throughput requirements.
  • Measure and size based on typical and worst‑case call graphs.

Growth, Scaling Strategies, and Automation

Capacity planning should define not just current size, but how the cluster will grow.

Organic Growth vs Stepwise Expansion

  • Organic growth:
    • Add nodes incrementally as utilization approaches a threshold (e.g., 60–70%).
    • Requires continuous monitoring and quick procurement or autoscaling.
  • Stepwise expansion:
    • Pre‑plan periodic expansions (e.g., quarterly) based on projected demand.
    • Useful when procurement or change management processes are slow.

Cluster Autoscaling

If using cluster autoscaler with cloud‑based infrastructure:

  • Define min/max node counts per machine pool.
  • Ensure there is:
    • Enough quota in the cloud provider.
    • Budgetary allowance for possible high‑water marks.
  • Align pod requests with autoscaling behavior:
    • Overly large pods may block scaling if no node size can fit them.
    • Many tiny pods may lead to fragmentation and inefficient bin packing.

Multi‑Cluster and Multi‑Tenant Strategies

For large environments:

  • Consider multiple clusters to:
    • Isolate environments (dev/test/prod, or different business units).
    • Separate highly specialized workloads (e.g., GPU/HPC vs general apps).
  • Capacity planning spans:
    • Per‑cluster sizing
    • Cross‑cluster routing and failover
    • Shared services (central logging, monitoring, CI/CD) that may have their own capacity plans.

Monitoring‑Driven Capacity Planning

Capacity planning is not static; OpenShift’s observability stack is central to continuous improvement.

Key Metrics to Track

At cluster and node level:

  • CPU and memory utilization (average, p95, p99)
  • Pod scheduling failures or pending pods due to insufficient resources
  • Node pressure conditions (memory, disk, PID)
  • Evictions and OOM kills
  • Storage usage per volume, per application, and per storage backend
  • Ingress/egress traffic volumes and router saturation

Capacity Dashboards and Alerts

Use or build dashboards that show:

  • Headroom trends over time (weeks/months)
  • Forecasted dates when utilization will hit thresholds (e.g., 80%).
  • Hot spots: nodes or namespaces regularly near saturation.

Set alerts for:

  • Sustained high utilization beyond planned thresholds.
  • Rapid growth in storage usage or network throughput.
  • Frequent pod evictions or FailedScheduling events.

These signals feed back into:

  • Decisions to add nodes or new clusters.
  • Adjustments to resource requests/limits and quotas.
  • Changes in logging/metrics retention.

Operational Practices and Review Cycles

Capacity planning is part of ongoing operations, not a one‑off exercise.

  • Regular reviews (e.g., monthly or quarterly):
    • Compare actual usage against planned capacity.
    • Validate growth assumptions and adjust forecasts.
  • Change impact assessments:
    • Analyze the capacity impact of major application deployments, new Operators, or big configuration changes.
  • Pre‑upgrade checks:
    • Before major OpenShift upgrades, verify enough spare capacity to handle:
      • Node drains and rolling restarts.
      • Any additional resource needs of the new release.
  • Documentation and communication:
    • Document capacity assumptions, thresholds, and SLOs.
    • Communicate with application teams about quotas and expected scaling behavior.

By treating capacity planning as a continuous, metrics‑driven process tightly integrated with OpenShift operations, you maintain a platform that is both reliable and cost‑efficient, and that can evolve predictably as workloads and business needs grow.

Views: 0

Comments

Please login to add a comment.

Don't have an account? Register now!

Where to Move

Move chapter:

  • ☰ 1. Course Overview
    • ☰ 1.1. What is OpenShift
      • ☰ 1.2. Why OpenShift is used in modern IT and cloud environments
        • ☰ 1.3. OpenShift vs Kubernetes
          • ☰ 1.4. Typical OpenShift use cases
            • ☰ 1.5. Structure and goals of the course
            • ☰ 2. Containers and Cloud-Native Fundamentals
              • ☰ 2.1. What is a container
                • ☰ 2.2. Containers vs virtual machines
                  • ☰ 2.3. Introduction to Docker and container images
                    • ☰ 2.4. Container registries
                      • ☰ 2.5. Basics of cloud-native applications
                      • ☰ 3. Kubernetes Fundamentals
                        • ☰ 3.1. What is Kubernetes
                          • ☰ 3.2. Kubernetes architecture
                            • ☰ 3.3. Control plane components
                              • ☰ 3.4. Worker node components
                                • ☰ 3.5. Kubernetes objects and resources
                                  • ☰ 3.6. Declarative configuration model
                                  • ☰ 4. OpenShift Architecture
                                    • ☰ 4.1. Overview of OpenShift architecture
                                      • ☰ 4.2. Control plane in OpenShift
                                        • ☰ 4.3. Nodes and machine roles
                                          • ☰ 4.4. OpenShift Operators
                                            • ☰ 4.5. OpenShift networking model
                                              • ☰ 4.6. OpenShift storage model
                                              • ☰ 5. OpenShift Installation and Deployment Models
                                                • ☰ 5.1. OpenShift deployment options
                                                  • ☰ 5.2. Installer-Provisioned Infrastructure
                                                    • ☰ 5.3. User-Provisioned Infrastructure
                                                      • ☰ 5.4. Managed OpenShift services
                                                        • ☰ 5.5. Single-node OpenShift
                                                          • ☰ 5.6. Cluster lifecycle management
                                                          • ☰ 6. Accessing and Using OpenShift
                                                            • ☰ 6.1. OpenShift web console
                                                              • ☰ 6.2. OpenShift CLI (oc)
                                                                • ☰ 6.3. Authentication and authorization
                                                                  • ☰ 6.4. Projects and namespaces
                                                                    • ☰ 6.5. Resource quotas and limits
                                                                    • ☰ 7. Building and Deploying Applications
                                                                      • ☰ 7.1. Application deployment concepts
                                                                        • ☰ 7.2. Source-to-Image (S2I)
                                                                          • ☰ 7.3. Container-based deployments
                                                                            • ☰ 7.4. DeploymentConfigs and Deployments
                                                                              • ☰ 7.5. Rolling updates and rollbacks
                                                                              • ☰ 8. Networking in OpenShift
                                                                                • ☰ 8.1. Services and service discovery
                                                                                  • ☰ 8.2. Routes and ingress
                                                                                    • ☰ 8.3. Network policies
                                                                                      • ☰ 8.4. Load balancing
                                                                                        • ☰ 8.5. External access to applications
                                                                                        • ☰ 9. Storage in OpenShift
                                                                                          • ☰ 9.1. Persistent storage concepts
                                                                                            • ☰ 9.2. Persistent Volumes
                                                                                              • ☰ 9.3. Persistent Volume Claims
                                                                                                • ☰ 9.4. StorageClasses
                                                                                                  • ☰ 9.5. Dynamic provisioning
                                                                                                    • ☰ 9.6. Stateful applications
                                                                                                    • ☰ 10. Configuration and Secrets Management
                                                                                                      • ☰ 10.1. ConfigMaps
                                                                                                        • ☰ 10.2. Secrets
                                                                                                          • ☰ 10.3. Environment variables
                                                                                                            • ☰ 10.4. Managing sensitive data
                                                                                                              • ☰ 10.5. Best practices for configuration
                                                                                                              • ☰ 11. Scaling and High Availability
                                                                                                                • ☰ 11.1. Horizontal pod autoscaling
                                                                                                                  • ☰ 11.2. Vertical scaling
                                                                                                                    • ☰ 11.3. Self-healing and pod restarts
                                                                                                                      • ☰ 11.4. High availability concepts
                                                                                                                        • ☰ 11.5. Multi-zone and multi-region clusters
                                                                                                                        • ☰ 12. Monitoring, Logging, and Observability
                                                                                                                          • ☰ 12.1. Built-in monitoring stack
                                                                                                                            • ☰ 12.2. Metrics and alerts
                                                                                                                              • ☰ 12.3. Logging architecture
                                                                                                                                • ☰ 12.4. Distributed tracing
                                                                                                                                  • ☰ 12.5. Troubleshooting applications
                                                                                                                                  • ☰ 13. Security in OpenShift
                                                                                                                                    • ☰ 13.1. Security model overview
                                                                                                                                      • ☰ 13.2. Role-Based Access Control
                                                                                                                                        • ☰ 13.3. Security Context Constraints
                                                                                                                                          • ☰ 13.4. Image security and scanning
                                                                                                                                            • ☰ 13.5. Network security
                                                                                                                                              • ☰ 13.6. Compliance and auditing
                                                                                                                                              • ☰ 14. CI/CD and DevOps with OpenShift
                                                                                                                                                • ☰ 14.1. DevOps concepts
                                                                                                                                                  • ☰ 14.2. CI/CD pipelines overview
                                                                                                                                                    • ☰ 14.3. OpenShift Pipelines (Tekton)
                                                                                                                                                      • ☰ 14.4. GitOps with Argo CD
                                                                                                                                                        • ☰ 14.5. Integrating OpenShift with external CI tools
                                                                                                                                                        • ☰ 15. Operators and Platform Services
                                                                                                                                                          • ☰ 15.1. What are Operators
                                                                                                                                                            • ☰ 15.2. Operator Lifecycle Manager
                                                                                                                                                              • ☰ 15.3. Installing and managing Operators
                                                                                                                                                                • ☰ 15.4. Common platform Operators
                                                                                                                                                                  • ☰ 15.5. Custom Operators
                                                                                                                                                                  • ☰ 16. Upgrades, Maintenance, and Operations
                                                                                                                                                                    • ☰ 16.1. OpenShift upgrade process
                                                                                                                                                                      • ☰ 16.2. Backup and restore
                                                                                                                                                                        • ☰ 16.3. Node maintenance
                                                                                                                                                                          • ☰ 16.4. Cluster troubleshooting
                                                                                                                                                                            • ☰ 16.5. Capacity planning
                                                                                                                                                                            • ☰ 17. OpenShift on HPC and Specialized Workloads
                                                                                                                                                                              • ☰ 17.1. Running batch workloads on OpenShift
                                                                                                                                                                                • ☰ 17.2. OpenShift and GPUs
                                                                                                                                                                                  • ☰ 17.3. MPI and parallel workloads in containers
                                                                                                                                                                                    • ☰ 17.4. Hybrid HPC and cloud workflows
                                                                                                                                                                                    • ☰ 18. OpenShift in Practice
                                                                                                                                                                                      • ☰ 18.1. Typical OpenShift workflows
                                                                                                                                                                                        • ☰ 18.2. Development to production lifecycle
                                                                                                                                                                                          • ☰ 18.3. Case studies from industry
                                                                                                                                                                                            • ☰ 18.4. Common pitfalls and best practices
                                                                                                                                                                                            • ☰ 19. Future Directions and Ecosystem
                                                                                                                                                                                              • ☰ 19.1. Kubernetes ecosystem overview
                                                                                                                                                                                                • ☰ 19.2. OpenShift roadmap
                                                                                                                                                                                                  • ☰ 19.3. Serverless and event-driven workloads
                                                                                                                                                                                                    • ☰ 19.4. AI and data platforms on OpenShift
                                                                                                                                                                                                    • ☰ 20. Final Project and Hands-On Exercises
                                                                                                                                                                                                      • ☰ 20.1. Deploying a containerized application
                                                                                                                                                                                                        • ☰ 20.2. Implementing CI/CD with OpenShift
                                                                                                                                                                                                          • ☰ 20.3. Securing and scaling an application
                                                                                                                                                                                                            • ☰ 20.4. Monitoring and troubleshooting report