Skip to main content

Enable autoscaling for a 3B Helm release

Written by Aron Day

BETA You’re responsible for monitoring and scaling your self-hosted 3B deployment. Use this guide at your own risk and test changes before applying them in production.

The autoscaling.enabled setting currently supports only KEDA. Install and verify KEDA before setting it to true in 3B v10.2.0 or later.

For 3B installs that use the OCI Helm chart, this example keeps your replica minimums and lets workers scale to three pods and Edge to two. If you installed 3B with bootstrap.sh, follow the K3s autoscaling guide.

You need Metrics Server and KEDA. 3B sends metrics to the OTLP/HTTP Collector and KEDA queries Prometheus in monitoring. Monitor a 3B Helm release · Install KEDA

1. Check the release and the cluster

Use Bash with your usual kubeconfig and OCI registry login.

kubectl config current-context
helm list --all-namespaces

Find your deployed 3B release and set release and namespace to its NAME and NAMESPACE. Keep using this shell.

release=3b
namespace=3b
kubectl -n "$namespace" get deployment edge worker
kubectl -n "$namespace" get scaledobjects.keda.sh,hpa
kubectl top nodes
kubectl describe nodes
kubectl wait --for=condition=Available apiservice/v1beta1.external.metrics.k8s.io --timeout=2m
kubectl -n monitoring get service otel-collector monitoring-kube-prometheus-prometheus
  • Edge and worker show all replicas ready (for example, 1/1).

  • kubectl top nodes shows CPU and memory usage. The external metrics API reports condition met.

  • The example uses port 4318 for the Collector and 9090 for Prometheus. Use your own endpoints in step 2 if they differ.

To add two default workers and one Edge pod, budget 3 extra vCPUs, 10 GiB of RAM, and 104 GiB of local worker disk. This includes room for the orchestrator during rollout. Check that each pod fits on a node where it can run. Cluster sizing

Remove any independently configured HorizontalPodAutoscaler (HPA) targeting Edge or workers before enabling KEDA.

2. Set the replica limits and apply the values

Use vi, vim, or nano to create 3b-autoscaling.yaml alongside your release values. Paste the YAML below and save the file. Set each maximum at or above its existing replica minimum. If you use an HTTP proxy, include the Collector hostname in httpProxy.noProxy.

autoscaling:
  enabled: true
  otlpMetricsEndpoint: http://otel-collector.monitoring.svc:4318/v1/metrics
  prometheusUrl: http://monitoring-kube-prometheus-prometheus.monitoring.svc:9090
edge:
  maxReplicas: 2
worker:
  maxReplicas: 3

Enable autoscaling when traffic is low. Edge and workers can briefly drop to one replica each when KEDA takes over. With the default rollout, webhooks can fail while Kubernetes replaces the only ready Edge pod.

If a deployment controller owns the release, add the file to its values and sync it. For a release you manage with Helm, run this command.

Use your installed 3B chart version. Find your release in the helm list output from step 1. Replace <VERSION> below with the version after 3b- in the CHART column.

VERSION='<VERSION>'
helm upgrade --install "$release" oci://oci.tines.com/3b/charts/3b \
  --namespace "$namespace" --version "$VERSION" \
  --reuse-values --values 3b-autoscaling.yaml \
  --wait --wait-for-jobs --timeout 30m

--reuse-values preserves your other settings. Pass the autoscaling file after your existing values files on future upgrades.

3. Verify the autoscalers

kubectl -n "$namespace" wait --for=condition=Ready scaledobject/edge scaledobject/worker --timeout=5m
kubectl -n "$namespace" get scaledobjects.keda.sh,hpa
kubectl -n "$namespace" describe hpa keda-hpa-edge keda-hpa-worker

Expect Ready=True on both ScaledObjects, MAXPODS 2 on Edge, and MAXPODS 3 on worker. Both HPAs should report ScalingActive=True with ValidMetricFound.

Watch workers scale

Start two overlapping workflows that each hold a slot. With one slot per worker, the HPA requests three workers, including one spare.

kubectl -n "$namespace" get deployment worker --watch

3/3 in READY confirms all three workers are ready. Press Ctrl+C to stop watching. For Grafana, unknown metrics, or pending workers, see Common questions about 3B autoscaling.

Return to fixed replica counts

Set autoscaling.enabled: false, worker.replicas, and edge.replicas in the same values file. Repeat the upgrade from step 2. Verify the HPAs disappear with kubectl -n "$namespace" get hpa and check the fixed counts with kubectl -n "$namespace" get deployment edge worker.

Did this answer your question?