Skip to Content
GuideRebalance ConfigurationWorkload Configuration Guide

Workload Configuration Guide

CloudPilot AI’s Workload Configuration feature allows you to customize how your workloads are managed during rebalance operations. This guide explains the available configuration options and how to use them effectively.

1. Configuration Overview

The workload configuration interface provides three key settings:

workload-config-enable

Rebalanceable Configuration

This setting determines whether a workload can be part of a Rebalance operation, meaning it can be moved or adjusted by the system as part of resource optimization. Enabling this option allows your workload to be managed and rebalanced by the system for better resource allocation.

Spot Friendly Configuration

This option specifies whether a workload is compatible with CloudPilot AI’s Spot Scheduling, which allows workloads to run on spot instances that are often cheaper but may be terminated by the cloud provider with little notice. This configuration takes effect only if Rebalanceable is enabled.

Min Non-Spot Replicas Configuration

This configuration sets the minimum number of Non Spot Replicas required for the workload. It ensures that even when spot instances are used, a certain number of replicas remain on more stable, non-spot instances. This setting is only relevant when the Spot Friendly configuration is enabled.

2. Configure Workload Policies with Kubernetes Metadata

Version requirement: These metadata controls require CloudPilot AI v1.21.0 or later.

You can opt a Deployment or StatefulSet out of Spot scheduling or rebalance by setting metadata directly on the workload. Add the metadata to the top-level metadata block, not to spec.selector.matchLabels.

PolicyMetadataValue that disables the policy
Spot FriendlyLabel workload.cloudpilot.ai/spot-friendly"false"
RebalanceableAnnotation workload.cloudpilot.ai/rebalanceable"false"

For example, the following Deployment is neither Spot Friendly nor Rebalanceable:

apiVersion: apps/v1 kind: Deployment metadata: name: api namespace: default labels: workload.cloudpilot.ai/spot-friendly: "false" annotations: workload.cloudpilot.ai/rebalanceable: "false" spec: # ...

Omit a key to keep that policy enabled. Only the exact string "false" opts out. The existing karpenter.sh/do-not-disrupt: "true" annotation also makes a workload non-rebalanceable.

The same label and annotation can be placed on Pods through spec.template.metadata or a PodMutation policy. Pod-level settings are opt-out only: they can make the effective policy more restrictive, but a Pod value cannot re-enable a policy disabled on its Deployment or StatefulSet.

spec: template: metadata: labels: workload.cloudpilot.ai/spot-friendly: "false" annotations: workload.cloudpilot.ai/rebalanceable: "false"

3. Personalized Workload Configuration

Here are practical examples of how to configure different workload types:

Example 1: Logging Service (log-server)

# Static logging service - Rebalanceable: ❌ Disabled - Spot Friendly: N/A - Min Non-Spot Replicas: N/A

Rationale: Logging services typically don’t need rebalancing and should remain stable.

Example 2: Web Server (nginx)

# Load balancer with mixed instances - Rebalanceable: ✅ Enabled - Spot Friendly: ✅ Enabled - Min Non-Spot Replicas: 5

Rationale: Ensures at least 5 stable replicas while allowing cost savings with spot instances.

Example 3: Database Workload (mysql)

# High availability database - Rebalanceable: ✅ Enabled - Spot Friendly: ❌ Disabled - Min Non-Spot Replicas: N/A

Rationale: Databases need stability, so they run only on on-demand instances.

workload-config-disable

4. Rebalance Effect

Once CloudPilot AI takes over the cluster, you will see that additional On-Demand instances have been provisioned for mysql and nginx, ensuring that 5 non-spot replicas for nginx and the stability of the mysql workload are maintained.

workload-config-result

This configuration provides the following benefits:

  • Optimized cost efficiency by utilizing spot instances where possible.
  • Reliable performance by ensuring critical workloads (like mysql) are run on stable, non-spot instances.
  • Increased flexibility in resource allocation as the system dynamically adjusts the workloads through the Rebalance feature.

With these configurations, CloudPilot AI will automatically manage and adjust your workloads for optimal performance, cost savings, and reliability.

Last updated on