Manage Autoscaling and HPA
"Autoscaling" is a term with many definitions. When we talk about autoscaling at Codiac, we are referring to one of two different types:
- Vertical node autoscaling
- Horizontal pod autoscaling (HPA)
Vertical Node Autoscaling
You set up vertical node autoscaling when you create your cluster. During the cluster creation process you specify how many nodes you want the cluster to have.
If one of the nodes stops working or becomes unreachable, Kubernetes automatically spins up a new node.
Vertical autoscaling is a simple and effective way to handle basic failure situations. This method is responsive to dying pods. It is not responsive to more nuanced issues like traffic or workload.
Horizontal Autoscaling (HPA)
Horizontal pod autoscaling (HPA) is a powerful and flexible way to scale your infrastructure based on resource usage. HPA has two main benefits:
- Responsive performance: Automatically upscale in response to an increase in workloads.
- Cost savings: Run your cluster efficiently by automatically downscaling idle nodes.
HPA works from the memory and CPU footprint you want to maintain per service.
Contact us if you are interested in setting up HPA based on custom scaling parameters.
Add HPA
HPA is a set of configurations for an asset which are scoped to a cabinet.
You must add the Limit and Request for CPU and/or memory in order to scale by these factors.
Autoscaling properties are inherited just like other configurations. If you set autoscaling at the environment level, it will automatically be applied to all the cabinets in that environment.
Use codiac config add
to set HPA on your asset.
- Select the asset.
- For Config select footprint if it exists.
- If this is the first footprint entry, select create new, then select footprint.
- For Setting select one of the following:
- cpuLimit
- Maximum number of millicores allocated to the asset.
- Values are in the format of Nm where N = number of millicores.
- For example, enter
800m
to allocate 800 millicores.
- cpuRequest
- Minimum number of millicores allocated to the asset.
- Values are in the format of Nm where N = number of millicores.
- For example, enter
100m
to allocate 100 millicores.
- memLimit
- Maximum number of megabytes allocated to the asset.
- Values are in the format of Nmi where N = number of megabytes.
- For example, enter
800mi
to allocate 800 megabytes.
- memRequest
- Maximum number of megabytes allocated to the asset.
- Values are in the format of Nmi where N = number of megabytes.
- For example, enter
800mi
to allocate 800 megabytes.
- scaling.min
- The minimum number of replicas.
- scaling.max
- The maximum number of replicas.
- scaling.disabled
- Set this value to
false
to enable autoscaling. - Set this value to
true
to disable autoscaling. - Note: You can use this setting to turn autoscaling off or on in specific cabinets and to override activation in a parent environment.
- Set this value to
- targetValue
- The percentage at which a new replica is triggered. This is 75% by default for both CPU and memory.
- You can override this setting with scaling.metrics.cpu.targetValue and/or scaling.metrics.mem.targetValue.
- cpuLimit
Repeat this process to add each setting. When all of your autoscaling settings are correct, set scaling.disabled to false
to enable autoscaling.
- For Scope select the cabinet you want to use.
- For Value in cabinet CABINET_NAME enter the value you want to specify.
- For Apply? enter
Y
to apply the new footprint entry.
Show HPA settings
Use codiac config view
to view your existing HPA footprint settings.
Follow the prompts to:
- Select the asset.
- Select footprint.
- Select the cabinet.
Edit HPA settings
Use codiac config add
to edit your HPA settings.
- For Target select footprint.
- For Setting select the setting you want to change.
- For Scope select the cabinet.
- For Value in cabinet CABINET_NAME enter the new value.
- For Apply? enter
Y
to update the footprint entry.
Delete HPA settings
Use codiac config delete
to delete an HPA setting.
- Select the asset.
- For Config select footprint.
- Select the setting you want to delete.
- Select the cabinet.
The setting is deleted.