Autoscaling¶
Scale FreeRADIUS pods automatically based on CPU utilization.
Overview¶
The operator manages a Kubernetes HorizontalPodAutoscaler (HPA) for each RadiusCluster that has autoscaling enabled. This lets your RADIUS infrastructure scale with demand — handling peak authentication loads without over-provisioning during quiet periods.
Prerequisites¶
Your cluster must have the Metrics Server installed. Verify with:
If this returns metrics, you're ready. If not, install the Metrics Server first.
Enable Autoscaling¶
apiVersion: radius.operator.io/v1alpha1
kind: RadiusCluster
metadata:
name: production
namespace: radius
spec:
image: freeradius/freeradius-server:3.2.3
replicas: 2
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
cpu: "1"
memory: 512Mi
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70
Note
When autoscaling is enabled, the spec.replicas field is ignored. The HPA controls the replica count between minReplicas and maxReplicas.
Configuration¶
| Field | Default | Description |
|---|---|---|
enabled |
false |
Set to true to create the HPA |
minReplicas |
1 |
Floor for pod count — never scale below this |
maxReplicas |
10 |
Ceiling for pod count — never scale above this |
targetCPUUtilizationPercentage |
80 |
Target average CPU usage across all pods |
How It Works¶
- When
autoscaling.enabledistrue, the operator creates an HPA targeting the FreeRADIUS Deployment - The HPA monitors average CPU utilization across pods
- When utilization exceeds the target, the HPA increases replicas (up to
maxReplicas) - When utilization drops, the HPA decreases replicas (down to
minReplicas) - If you set
autoscaling.enabledback tofalse, the operator deletes the HPA andspec.replicastakes effect again
Resource Requests Are Required¶
The HPA calculates CPU utilization as a percentage of the CPU request. If you don't set resources.requests.cpu, the HPA has no baseline and cannot make scaling decisions.
Sizing Guidelines¶
| Deployment Size | minReplicas | maxReplicas | Target CPU |
|---|---|---|---|
| Development | 1 | 3 | 80% |
| Small office (< 500 users) | 2 | 5 | 75% |
| Campus (500–5000 users) | 3 | 10 | 70% |
| Enterprise (5000+ users) | 5 | 20 | 65% |
These are starting points — adjust based on your observed authentication patterns and response time requirements.
Disable Autoscaling¶
Set enabled: false and specify your desired replica count:
The operator deletes the HPA and sets the Deployment to 3 replicas.