Kubernetes HPA Generator
Generate a Kubernetes HorizontalPodAutoscaler (HPA) in YAML with min, max replicas and a CPU target. Scale your pods automatically as load changes.
YAML
—
Scaling pods automatically on CPU usage
The HorizontalPodAutoscaler is the Kubernetes object that raises and lowers the replica count of a Deployment as load changes. It watches a metric, compares it against the target you set and adjusts the count to bring the average back to that target. Without it, sizing means choosing between paying for idle capacity or having no headroom at peak.
Fill in the resource name, the target Deployment, the minimum and maximum replica bounds and the desired CPU percentage. The page returns the manifest on autoscaling/v2, the current version and the one that accepts multiple metrics. Save it to a file and apply with kubectl apply -f. A 70% target is a reasonable starting point: it leaves room for the time a new pod takes to come up and become ready.
One requirement sinks a lot of configurations: the CPU percentage is computed against each container's requests.cpu, not against the limit and not against node capacity. If the Deployment declares no CPU requests, the HPA cannot work out the ratio and sits there with no metric, showing unknown under kubectl get hpa. metrics-server also has to be installed in the cluster — without it, there is nowhere to read consumption from.
Frequently asked questions
Why does my HPA show unknown in the metric column?
Can I scale on something other than CPU?
Can an HPA coexist with a fixed replica count in the Deployment?
Related Tools
Kubernetes CronJob Generator
Generate a Kubernetes CronJob in YAML with the schedule expression and the container to run. Schedule recurring tasks in your cluster and apply with kubectl.
Kubernetes ConfigMap Generator
Generate a Kubernetes ConfigMap in YAML from key=value pairs, ready to apply with kubectl. Centralize your pod configuration in seconds.
Kubernetes Ingress Generator
Generates a Kubernetes Ingress with host, service and port, using the nginx ingressClassName and a root path. The TLS block is yours to add.
Kubernetes Secret Generator
Generate a Kubernetes Secret in YAML with values already base64-encoded. Store passwords and tokens safely and apply them to your cluster with kubectl.
GitHub Actions Generator
Generate YAML workflows for GitHub Actions: Node CI, static deploy, semver release, lint+test. Customize triggers and steps. Everything in your browser.
Docker Run → Compose
Convert a docker run command to the equivalent docker-compose.yml automatically. Maps ports, volumes, environment variables, networks and restart policies.