OpenShift HPA Explained¶
Introduction¶
Resource requests, limits, and autoscaling control how an OpenShift workload is scheduled and scaled. Set requests for predictable scheduling and limits only where you understand the application behavior.
Before You Start¶
Make sure you are in the correct project and know whether the application is driven by a Deployment, DeploymentConfig, BuildConfig, ImageStream, or external registry image.
Practical Examples¶
oc set resources deployment/web --requests=cpu=100m,memory=256Mi --limits=cpu=500m,memory=512Mi -n app
oc autoscale deployment/web --min=2 --max=6 --cpu-percent=70 -n app
oc get hpa web -n app
oc adm top pods -n app
Example output:
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
web Deployment/web 24%/70% 2 6 2 3m
Verification¶
oc describe hpa web -n app
oc adm top pods -n app
oc describe deployment web -n app
Troubleshooting¶
Verify CPU or memory requests exist, check metrics availability, inspect HPA conditions, and confirm replicas change under real load.
Common Mistakes¶
- Configuring HPA without CPU requests.
- Setting memory limits too low and causing OOMKilled restarts.
- Using autoscaling as a substitute for fixing slow code.
Quick Checklist¶
- Confirm the active project.
- Inspect the exact object named in the error.
- Read recent events.
- Apply one focused fix.
- Verify status after the change.
Related Guides¶
- Openshift New App Explained
- Openshift Imagestream Explained
- Openshift Application Deployment Checklist
Summary¶
OpenShift HPA Explained should be verified with commands that match the OpenShift object being changed or investigated.