How-to: Manage scaling policies
Once you've created your scaling policies, ongoing management involves assigning workloads, modifying policy configurations, and maintaining your optimization strategy as your infrastructure evolves. This guide covers the key management tasks for keeping your scaling policies effective and up-to-date.
Workload assignment and reassignment
Managing which workloads are assigned to specific scaling policies is a core aspect of workload optimization. You can control assignments through assignment rules or manual assignment methods.
View policy assignments
You can view policy assignments and workload distributions in several ways:
From the scaling policies table:
- Navigate to Workload Autoscaler > Scaling policies
- The Workloads column shows the number of workloads assigned to each policy
- Click on the workload count to see a detailed list of assigned workloads in the drawer that opens
From the workloads list:
- Navigate to Workload Autoscaler > Optimization
- The Scaling policy column shows which policy is assigned to each workload
- Use the Scaling policy filter dropdown to view workloads assigned to specific policies
From the workload details page:
- Navigate to the workload details page by clicking on a workload
- In the Rightsizing settings section, locate Vertical scaling policy
- Use the dropdown to select a different policy
- Save the changes
Understanding policy assignment methods
Cast AI uses multiple methods to assign workloads to scaling policies. Understanding these methods and their priority helps you troubleshoot assignment issues and design effective scaling strategies.
Policy assignment priority hierarchy
Workload Autoscaler evaluates workload assignments in the following priority order:
-
Manual/Explicit Assignment
- API assignments – Policies assigned via the Cast AI API
- Annotation assignments – Policies specified using
workloads.cast.ai/configurationwithscalingPolicyName - Direct UI assignments – Policies manually assigned through the Optimization page in the Cast AI Console
-
Assignment Rules
- Evaluated based on policy priority order (as configured in the policies table)
- The first matching policy wins
- Rules within a policy use
ANDlogic; rules between policies useORlogic
-
System Defaults If workloads have not been manually assigned to policies, and if no assignment rules match them, they will be moved to default system scaling policies:
- StatefulSets:
resiliency - All other workloads:
balanced
- StatefulSets:
Assignment origin tracking
Cast AI tracks how each workload was assigned to its current policy through a scalingPolicyOrigin field available via the API response for each workload. This field indicates the assignment method:
| Value | Assignment Method |
|---|---|
api | Assigned via Cast AI API |
annotations | Assigned via Kubernetes annotations |
assignment-rules | Assigned through policy assignment rules |
default | Assigned through system defaults |
You can query this information using the Get workload API endpoint:
curl --request GET \
--url https://api.cast.ai/v1/workload-autoscaling/clusters/{clusterId}/workloads/{workloadId} \
--header 'X-API-Key: <YOUR_API_KEY>' \
--header 'accept: application/json'The response includes the scalingPolicyOrigin field along with scalingPolicyId and scalingPolicyName to provide a complete assignment context:
{
"workload": {
"name": "example-deployment",
"namespace": "production",
"kind": "Deployment",
"scalingPolicyId": "policy-123",
"scalingPolicyName": "production-frontend-policy",
"scalingPolicyOrigin": "assignment-rules",
// ... other workload fields
},Assign workloads in bulk
To assign multiple workloads to a scaling policy:
- Navigate to Workload Autoscaler > Optimization
- Use the checkboxes to select multiple workloads from the list
- Click on Assign vertical scaling policy
- Select the target scaling policy from the available options
- Confirm the assignment
You can filter workloads before bulk assignment using the plethora of different options to narrow down your selection.
Impact of manual assignment: When you manually assign workloads through the UI, these assignments take precedence over assignment rules. This means the workloads will remain assigned to the selected policy even if you later create or modify assignment rules that would match them.
Move workloads between policies
The process of moving workloads between policies is exactly the same as the process of assigning them to a policy for the first time. Therefore, reference the workload assignment and reassignment section above.
Impact of policy changes:
- New policy settings take effect immediately
- Recommendations are recalculated based on the new policy configuration
- Manual reassignments override any existing assignment rules
Manage unassigned workloads
Workloads that don't match any assignment rules are automatically assigned through system defaults based on their workload type:
- StatefulSets: Assigned to
resiliencypolicy - Other workloads: Assigned to
balancedpolicy
These system policies typically show higher workload counts in clusters without extensive assignment rules.
For better, more targeted workload optimization:
- Review workloads assigned to system default policies (
balanced,resiliency) - Create appropriate assignment rules to automatically capture these workloads and assign them to more specific system policies or custom policies that you have configured
- Alternatively, manually reassign individual workloads to more specific policies through the UI
Assignment rule management
Assignment rules automatically assign workloads to policies based on their characteristics. You can manage these rules from the policy view.
Add a new assignment rule
For detailed information on the configuration options of assignment rules, refer to our guide on creating a scaling policy.
To add assignment rules to an existing policy, follow these steps:
- Navigate to the scaling policy details page
- Go to the Assignment rules tab
- Click Add rule to create additional assignment criteria
- Configure namespace, workload type, and label filters
- Save the policy to activate the new rules
Modify or delete an assignment rule
To modify an existing assignment rule,
- Navigate to the scaling policy details page
- Go to the Assignment rules tab
- Use the Filters applied panel to review current rule settings
- Configure namespace, workload type, and label filters
- Optionally, remove individual filters using the X button next to each filter
To remove an assignment rule:
- Use the Delete assignment rule option in the rule configuration menu
- Confirm the deletion to remove the rule permanently
Workloads previously matched by the deleted rule will be reassigned based on remaining rules or moved to the default policy.
Impact of rule changes: Changes to assignment rules trigger asynchronous workload reassignment. In large clusters, this process may take a few seconds or more to complete. Workloads with manual assignments will not be affected by assignment rule changes.
Policy modification and updates
Scaling policies need to evolve as your workloads and optimization requirements change. Understanding how to modify policies and their impact on assigned workloads is crucial.
Edit policy settings
You can modify scaling policy settings at any time:
Accessing policy settings:
- Navigate to Workload Autoscaler > Scaling policies
- Click on the policy name to open the policy details view
- Use the Settings tab to modify optimization parameters
Refer to our guide on creating a scaling policy for detailed instructions or our reference document on available settings for all available configuration options.
Impact on assigned workloads:
- Settings changes apply immediately to all workloads assigned to the policy
- New resource request recommendations are generated based on updated policy parameters
Policy lifecycle management
Managing the lifecycle of scaling policies includes enabling, disabling, and removing policies while ensuring workload continuity.
Enable and disable automated optimization
You can temporarily disable the automated resource optimization aspect of policies without deleting them, as well as re-enable it later when your requirements change. To do so, follow these steps:
- Toggle the policy switch to the on/off position in the scaling policies table
Impact on assigned workloads:
- Workloads remain assigned to disabled policies, but optimization is paused
- Assignment rules for disabled policies continue to match new workloads
- Recommendations can still be viewed, but won't be applied automatically
- Workloads continue running with their current resource allocations
Delete a policy
Deleting policies is irreversible and requires careful consideration:
Prerequisites before deletion:
- Review all workloads assigned to the policy
- Decide whether to reassign workloads to other policies or let them be reassigned by the assignment rules of other policies
Deletion process:
- Navigate to Workload Autoscaler > Scaling policies
- Click on the policy name to open the policy details view
- Use the policy actions menu (three dots) to select Delete policy
- Confirm the deletion in the dialog box
- The policy is permanently removed from the system
What happens to workloads: Workloads from deleted policies are automatically reassigned following the priority hierarchy:
- First, the system checks for other policies with assignment rules that match these workloads
- If multiple policies match, the highest-priority policy is selected
- If no assignment rules match, workloads fall back to system defaults (
resiliencyfor StatefulSets,balancedfor other workloads)
Asynchronous reassignment: The reassignment process is asynchronous and may take several minutes to complete in large clusters. You can monitor the progress by checking policy workload counts and the workloads list.
Next steps
- Create scaling policies – Learn how to create new policies with specific optimization settings
- Workload autoscaling settings – Explore detailed configuration options for policy settings
Updated 26 days ago
