To enable Thoras to manage or recommend scaling for your workload, you must register an AIScaleTarget Custom Resource (CRD) in your Kubernetes cluster. This guide will walk you through doing this by applying an AIScaleTarget resource with kubectl.

Prerequisites

0. (Optional) Auto-configure AIScaleTargets using the dashboard

On a fresh installation, Thoras can auto-discover workloads and make suggestions to auto-populate AIScaleTargets in the cluster. This enables metric collection and resource recommendations for the selected workloads (see quickstart guide).

Eventually you will probably want to integrate your AIScaleTarget configurations into your delivery pipelines, but the auto-populate feature is a particularly useful way to try out the product without having to manage any configuration.

1. Define Initial AIScaleTarget Custom Resource

Create a new file named my-ast.yaml

apiVersion: thoras.ai/v1
kind: AIScaleTarget
metadata:
  name: {{ YOUR_AST_NAME }}
  namespace: {{ YOUR_NAMESPACE }}
spec:
  model:
    forecast_blocks: 15m
    forecast_cron: "*/15 * * * *"
  scaleTargetRef:
    kind: Deployment
    name: {{ YOUR_AST_NAME }}
  horizontal:
    mode: recommendation
  • metadata.name: The name for your AIScaleTarget resource (should match your workload name for clarity).
  • metadata.namespace: The namespace where your workload is running.
  • spec.scaleTargetRef: Points to the Kubernetes resource (usually a Deployment) you want to scale.
  • spec.model.forecast_blocks: How far into the future to forecast
  • spec.model.forecast_cron: How often to make a forecast.

2. Apply the AIScaleTarget Using the CLI

Use kubectl apply to register the AIScaleTarget with your cluster:

kubectl apply -f my-ast.yaml

You should see output like:

aiscaletarget.thoras.ai/my-name created

3. Verify the AIScaleTarget

Check that your AIScaleTarget was created:

kubectl get aiscaletarget -n my-namespace

To see details:

kubectl describe aiscaletarget my-app -n my-namespace

Note: An existing AIScaleTarget can be exported to a YAML for version control or editing with:

kubectl get aiscaletarget <name> -n <namespace> -o yaml > my-ast.yaml