LogoTensorFusion Docs
LogoTensorFusion Docs
Homepage

Getting Started

OverviewKubernetes InstallVM/Server Install(K3S)Helm Quick InstallHost/GuestVM InstallTensorFusion Architecture

Application Operations

Create WorkloadAnnotation Usage ScenariosConfigure AutoScalingMigrate Existing WorkloadBest Practices

Customize AI Infra

Production-Grade DeploymentConfig QoS and BillingBring Your Own CloudManaging License

Maintenance & Optimization

Upgrade ComponentsSetup AlertsGPU Live MigrationPreload ModelOptimize GPU Efficiency

Troubleshooting

HandbookTracing/ProfilingQuery Metrics & Logs

Reference

Comparison

Compare with NVIDIA vGPUCompare with MIG/MPSCompare with NVIDIA Run:aiCompare with HAMi

Configure AutoScaling

Let TensorFusion adjust the TFLOPS and VRAM requests and limits of a running workload from usage history, a schedule, or your own scaler

TensorFusion autoscaling is vertical: it changes the TFLOPS and VRAM requests and limits of each vGPU while the Pod keeps running. It does not change the number of replicas; use HPA or KEDA for that.

The quickest way to turn it on is one annotation. For percentiles, schedules or an external scaler, use a WorkloadProfile.

Prerequisites

  • A workload that already runs on TensorFusion. See Create Workload.
  • The controller runs with the -enable-auto-scale flag and can reach the metrics database. Both are on in the default Helm installation.
  • State the workload's compute in TFLOPS (tflops-request, tflops-limit) rather than in percent. The autoscaler writes its results as TFLOPS and VRAM values.

Step 1. Enable autoscaling with annotations

Add these annotations to the Pod template, next to the resource annotations:

metadata:
  annotations:
    tensor-fusion.ai/autoscale: "true"
    # compute | vram | all. Defaults to all when omitted.
    tensor-fusion.ai/autoscale-target: "all"
autoscale-targetWhat is adjusted
computeTFLOPS request and limit
vramVRAM request and limit
allBoth

With only these annotations, TensorFusion uses the default percentile settings from the table in step 2.

Step 2. Tune it with a WorkloadProfile

Put detailed settings in spec.autoScalingConfig of a WorkloadProfile and reference the profile from the Pod with tensor-fusion.ai/workload-profile.

apiVersion: tensor-fusion.ai/v1
kind: WorkloadProfile
metadata:
  name: autoscale-inference
spec:
  autoScalingConfig:
    autoSetResources:
      enable: true
      targetResource: all
      historyDataPeriod: 6h
      initialDelayPeriod: 30m
      marginFraction: "0.2"

autoSetResources.enable: true is the switch for the whole autoscaler. Cron rules and the external scaler described below are ignored without it.

If enable is true but targetResource is empty, TensorFusion only writes the recommendation to the workload status and changes nothing. Use this to preview what autoscaling would do. The tensor-fusion.ai/autoscale: "true" annotation always sets a target, so it always applies changes.

Usage-based settings

All values are strings in YAML, so quote the numbers.

FieldDefaultMeaning
enablefalseTurns the autoscaler on for this workload.
targetResourceemptycompute, vram or all. Empty means recommend only.
targetComputePercentile0.95Usage percentile used as the compute target.
lowerBoundComputePercentile0.5Usage percentile used as the compute lower bound.
upperBoundComputePercentile0.99Usage percentile used as the compute upper bound.
targetVRAMPercentile0.98Usage percentile used as the VRAM target.
lowerBoundVRAMPercentile0.5Usage percentile used as the VRAM lower bound.
upperBoundVRAMPercentile0.99Usage percentile used as the VRAM upper bound.
marginFraction0.15Safety margin added on top of each percentile.
updateThreshold0.1A request changes only when the new value differs from the current one by more than this fraction. Keep it below marginFraction.
historyDataPeriod2hHow far back usage is read. Capped at 30 days.
initialDelayPeriod30mHow long after the workload is created before scaling starts.
intervalglobal intervalHow often the workload is evaluated. The global value is dynamicConfig.autoScalingInterval in the Helm values, 30s if unset.
minComputeResourcesRatio0.1Lowest compute request, as a ratio of the original request.
maxComputeResourcesRatio10.0Highest compute request and limit, as a ratio of the original values.
minVRAMResourcesRatio0.2Lowest VRAM request and limit, as a ratio of the original values.
maxVRAMResourcesRatio5.0Highest VRAM request and limit, as a ratio of the original values.

How a recommendation is built from these numbers:

  • The limit becomes the upper bound.
  • The request depends on QoS: the lower bound for low and medium, the target for high, the upper bound for critical.
  • The result is clamped to the min and max ratios and never drops below 1 TFLOPS or 1Gi.
  • The compute limit never drops below the original limit, so a workload that was idle for a while is not throttled when load returns.
  • A scale-up never exceeds what is free on the GPUs the workload already uses.

Scale on a schedule

Cron rules set fixed resources during a time window. Outside every window, the workload returns to the resources it was created with.

spec:
  autoScalingConfig:
    autoSetResources:
      enable: true
      targetResource: all
    cronScalingRules:
      - name: business-hours
        enable: true
        start: "0 9 * * 1-5"
        end: "0 19 * * 1-5"
        desiredResources:
          requests:
            tflops: "40"
            vram: 8Gi
          limits:
            tflops: "80"
            vram: 10Gi
  • start and end are standard five-field cron expressions (minute, hour, day of month, month, day of week) and must differ. They are evaluated in the controller's time zone.
  • A rule without name, start or end, or with enable: false, is skipped.
  • While a rule is active, usage-based scaling cannot go below the rule's requests.

Use an external scaler

To make the decision in your own service, point TensorFusion at an HTTP endpoint:

spec:
  autoScalingConfig:
    autoSetResources:
      enable: true
      targetResource: all
    externalScaler:
      enable: true
      url: http://my-scaler.default.svc:8080/recommend
      apiKeySecretRef:
        name: my-scaler-key
        namespace: default

On each evaluation TensorFusion sends a POST with a JSON body and expects HTTP 200 with a JSON response. If apiKeySecretRef is set, TensorFusion reads the key from the Secret's apiKey, token or key field and sends it as Authorization: Bearer <key>.

Request body:

{
  "workloadName": "pytorch-vgpu",
  "namespace": "default",
  "currentResources": {
    "requests": { "tflops": "10", "vram": "4Gi" },
    "limits": { "tflops": "20", "vram": "4Gi" }
  }
}

Response body:

{
  "needScaleUp": true,
  "needScaleDown": false,
  "reason": "QueueTooLong",
  "recommendedResources": {
    "requests": { "tflops": "20", "vram": "4Gi" },
    "limits": { "tflops": "40", "vram": "4Gi" }
  }
}

When both needScaleUp and needScaleDown are false, nothing changes. A non-empty reason is recorded on the workload status. externalScaler.initialDelayPeriod defaults to 30m.

Apply one rule to many workloads

Pool administrators can attach autoscaling settings to every Pod that matches a label selector, without touching the workloads. Add verticalScalingRules to the SchedulingConfigTemplate the pool uses:

kubectl get gpupool <pool-name> -o jsonpath='{.spec.schedulingConfigTemplate}{"\n"}'
kubectl edit schedulingconfigtemplate <template-name>
spec:
  verticalScalingRules:
    - name: autoscale-inference
      selector:
        matchLabels:
          workload-type: inference
      autoScaling:
        autoSetResources:
          enable: true
          targetResource: all

The webhook merges the first rule whose selector matches the Pod's labels into the workload when the Pod is created.

Step 3. Check what the autoscaler did

Every workload has a TensorFusionWorkload object named after its Deployment, StatefulSet or Job. Its status shows the current state:

kubectl get tensorfusionworkload <workload-name> -o yaml
kubectl get events --field-selector involvedObject.kind=TensorFusionWorkload
status:
  conditions:
    - type: ResourceUpdate
      status: "True"
      reason: Updated
      message: "Compute scaled: request 10 -> 6, limit 20 -> 20"
  # Latest recommendation
  recommendation:
    requests:
      tflops: "6"
      vram: 3Gi
    limits:
      tflops: "20"
      vram: 4Gi
  # Number of Pods the recommendation has been applied to
  appliedRecommendedReplicas: 3
  # Present only while a cron rule is active
  activeCronScalingRule:
    name: business-hours
ConditionReasonMeaning
ResourceUpdateLowConfidenceThe workload is younger than initialDelayPeriod. Nothing is changed yet.
ResourceUpdateInsideUpdateThresholdThe change is smaller than updateThreshold. Nothing is changed.
ResourceUpdateUpdatedResources were changed. The message has the old and new values.
ResourceUpdateNoScalingNeededThe external scaler asked for no change.
RecommendationProvidedRuleActive, RuleInactiveA cron rule started or ended.

Each change also emits a ResourceScaledUp or ResourceScaledDown event on the TensorFusionWorkload.

A recommendation reaches Pods in two ways. Running Pods get their tflops-* and vram-* annotations updated in place; they are not restarted. Pods created later start with the recommended values.

Limitations

  • Replica count is not scaled.
  • Pods with tensor-fusion.ai/dedicated-gpu: "true" are skipped, because they already own whole GPUs.
  • Nothing happens during the first initialDelayPeriod after a workload is created. This also delays cron rules and the external scaler.

Next steps

  • Annotation reference
  • WorkloadProfile schema
  • Best practices

Annotation Usage Scenarios

Find your requirement, copy the annotations. One minimal Pod template per common vGPU scenario.

Migrate Existing Workload

Move workloads that request whole GPUs through a device plugin onto a TensorFusion GPU pool, a few replicas at a time

Table of Contents

Prerequisites
Step 1. Enable autoscaling with annotations
Step 2. Tune it with a WorkloadProfile
Usage-based settings
Scale on a schedule
Use an external scaler
Apply one rule to many workloads
Step 3. Check what the autoscaler did
Limitations
Next steps