Migrate from hdx-scaler to hdx-scaler-go
Hydrolix provides a custom autoscaling service capable of horizontal (pod count) and vertical (container resources) scaling based on Prometheus metrics and resource utilization. See Autoscaling Prometheus Metrics for more detail.
v5.11 introduced hdx-scaler-go, the canonical Hydrolix autoscaling service. If you are turning on autoscaling for the first time, see autoscaling-prometheus-metrics. Use this page to migrate a cluster that's already running the pre-v5.11 hdx-scaler for autoscaling.
Both hdx-scaler and hdx-scaler-go run as a singleton pod which is enforced by the Hydrolix Kubernetes operator. Both scalers may be enabled at the same time during migration. See Migration.
Migration steps⚓︎
There are three main sections:
Preparation⚓︎
- Prerequisites: Upgrade the cluster to v5.11 or above
- Deploy both scalers: Enable both scalers in the same cluster
Monitor and switch⚓︎
- Enable
hdx-scaler-gofor one service in dry-run mode: Enablehdx-scaler-gofor one service in dry-run mode.hdx-scalercontinues scaling every service. - Compare
hdx-scaler-godecisions againsthdx-scaler: Examinehdx-scaler-godecision log for parity. - Cut the service over to
hdx-scaler-go:hdx-scaler-gostarts scaling the service. - Repeat per service or move the whole cluster at once: Repeat service-by-service or for the whole cluster.
Confirmation⚓︎
- Confirm hdx-scaler is disabled: Verify that no services remain using hdx-scaler.
An optional rollback step is available at any time to return individual services or the entire cluster to using hdx-scaler.
Configuration⚓︎
Control the migration by using the engine field. This field can be set for the entire cluster or per service.
Set the engine field
You'll set this field to the following values in order during migration:
shadow: Usehdx-scalerto scale the cluster and computehdx-scaler-godecisions without making changes to the cluster.go: Usehdx-scaler-goto scale the cluster.- (optional)
python: Usehdx-scalerto scale the cluster. Disableshdx-scaler-go. See Rollback.
Prerequisites⚓︎
Confirm the cluster is on v5.11 or later.
Deploy both scaler services⚓︎
Set both scalers to a single replica in the HydrolixCluster spec and apply:
Both scalers deploy. The scaler engine defaults to python, so hdx-scaler continues scaling every service.
hdx-scaler vs hdx-scaler-go: Kubernetes object configuration
When enabled, hdx-scaler-go writes its configuration to an HPAConfig or VPAConfig object while hdx-scaler writes to a single ConfigMap object.
HPAConfig and VPAConfig are Hydrolix custom resources, which are new object types that extend the Kubernetes API and can be inspected like any other resource, for example, using kubectl describe hpaconfig intake-head.
A ConfigMap is a built-in Kubernetes object that holds configuration as key-value data and can be inspected with kubectl describe configmaps hdxscaler.
Enable hdx-scaler-go for one service in dry-run mode⚓︎
Add engine: shadow, which enables a dry-run mode for hdx-scaler-go, to a target service hdxscalers entry and apply:
hdx-scaler continues scaling the cluster.
Verification
Assuming the example config above for intake-head, expect the following results.
- Connect to the transitioning cluster
:hpaconfigor:vpaconfig- Press
ewhile highlightingintake-head - You should see the following fields/values at a minimum:
This configuration indicates that hdx-scaler-go is in dry run mode.
- Connect to the transitioning cluster
:configmaps- Press
ewhile highlightinghdxscaler - You should see the following fields/values at a minimum:
This configuration indicates that hdx-scaler is in live mode.
Compare hdx-scaler-go decisions against hdx-scaler⚓︎
Watch the hdx-scaler-go custom resource status and metrics while a representative load runs:
Check the MESSAGE column.
Decision-making messages like:
metric above targetmetric below targetmetric within tolerance
indicate that hdx-scaler-go is reading the target (such as the metric http_source_outstanding_reqs), applying calculations, and reaching a verdict.
Messages like the following indicate errors:
metric(s) unavailable:hdx-scaler-gocan't reach or scrape the metric and therefore can't make scaling-related decisions.deployment not found: The target deployment isn't available.
Additionally:
cooldown active: Indicates a recent scale-up or scale-down, resulting in a timer gating further scaling activities. This message should eventually transition to a decision-making message.
Cut over to hdx-scaler-go⚓︎
When the dry run behavior looks right, flip the entry to engine: go and apply:
Verify hdx-scaler-go is enabled
Assuming the example config above for intake-head, expect the following results.
- Connect to the transitioning cluster
:hpaconfigor:vpaconfig- Press
ewhile highlightingintake-head - You should see the following fields/values at a minimum:
This configuration indicates that hdx-scaler-go is in live mode.
- Run the shell command
kubectl describe hpaconfig intake-head - You should see the following fields/values at a minimum:
This configuration indicates that hdx-scaler-go is in live mode.
Repeat per service or move the whole cluster at once⚓︎
Either repeat Steps 2–5 for each remaining service or enable hdx-scaler-go for the entire cluster:
The engine field set at the per-service level overrides the cluster-wide setting, so you can continue to have specific scaled by hdx-scaler. When everything is using hdx-scaler-go, remove the hdx-scaler entry:
Confirm hdx-scaler is disabled⚓︎
Verify no services are using hdx-scaler
- Connect to the transitioning cluster
:configmaps- Press
ewhile highlightinghdxscaler - Assuming no other services are using
hdx-scaler, you should see the following fields/values:
This configuration indicates that hdx-scaler is disabled for all services.
- Run the shell command
kubectl describe configmaps hdxscaler - You should see the following fields/values indicating that no services are using
hdx-scaler:
This configuration indicates that hdx-scaler is disabled for all services.
Rollback (available at any step)⚓︎
Set the engine field back to one of the following:
engine: shadow: Useshdx-scalerto scale the service or cluster.hdx-scaler-goreturns to dry-run mode.engine: python: Useshdx-scalerto scale the service or cluster. Disableshdx-scaler-go.
When a service transitions from using go to python or shadow, the stale HPAConfig and VPAConfig custom resources are cleaned up by the operator in its next reconciliation.