Automation setup instruction
Set up PerfectScale Automation in minutes and start seeing instant optimization results with just a few simple steps
Step 1: Install PerfectScale Automation Agent
When deploying the PerfectScale Automation Agent in a GKE Private Cluster, you need to create an additional firewall rule. This enables the Control Plane address range to communicate with the Cluster Pod IPv4 address range on port 8443. If the webhook call fails, see the troubleshooting guide.
Deploy the PerfectScale automation agent. In order to install the PerfectScale automation agent, run the following commands:
helm repo add perfectscale https://perfectscale-io.github.io --force-updateand
helm upgrade --install -n perfectscale psc-autoscaler \
--set secret.create=false \
--set settings.psUrl=<https://api-{your-web-ui-url}> \
--set settings.telemetryUrl=<https://api-{{your-web-ui-url}}/psc-telemetry> \
perfectscale/psc-autoscalerIf you utilize CI/CD tools with auto-sync, ensure to review the additional configuration steps. Automation with GitOps
Verify Automation Agent Installation
To test and confirm that the Automation Agent was installed successfully, run the following command:
helm test psc-autoscaler -n perfectscale --logsDisabling Webhook for Specific Namespaces
Once the autoscaler is installed, all pods in the cluster go through the admission webhook. You can exclude specific namespaces from this process by disabling the webhook for them. For example:
helm upgrade --install -n perfectscale psc-autoscaler perfectscale/psc-autoscaler \
--set secret.create=false \
--set 'settings.excludedNamespaces={kube-system,ns_to_exclude1,ns_to_exclude2}'Step 2: Create Custom Resource (CR)
After the installation of the automation agent, it is important to create a cluster automation configuration, as this step is mandatory:
apiVersion: perfectscale.io/v1
kind: ClusterAutomationConfig
metadata:
name: cluster-automation-config
spec:
automation:
operational:
stopAllAutomation: false # Global kill switch for automation (default: false)
cleanupAllAutomation: false # Stops automation and reverts all changes, restoring original resource specifications and settingsTo help you quickly start using PerfectScale Automation and streamline the optimization process, we provide pre-built Custom Resources (CRs) focused on desired optimization goals. You can easily implement the following CRs and customize them if needed.
⚡ Recommended adoption path
To minimize waste and achieve optimal savings, we recommend starting with a simple, cluster-level automation focused on cost reduction.
Create a YAML file with the recommended cluster-level automation configuration using the following template:
apiVersion: perfectscale.io/v1
kind: ClusterAutomationConfig
metadata:
name: cluster-automation-config
spec:
automation:
operational:
stopAllAutomation: false # Global kill switch for automation (default: false)
cleanupAllAutomation: false # Stops automation and reverts all changes, restoring original resource specifications and settings
workloadTypes:
Deployment:
operational:
automationMode: "Enabled" # Enables automation for the workloads with a specific type in the cluster/namespace
restrictions:
DaemonSet:
operational:
automationMode: "Enabled" # Enables automation for the workloads with a specific type in the cluster/namespace
restrictions:Apply the created configuration by running the following command (where cluster-automation-config.yaml - the name of your file created in the previous step):
kubectl apply -f cluster-automation-config.yamlCombining cost-savings and performance improvement configuration
The following example of a Cluster-level automation configuration allows you to automate the optimization of the entire cluster, enhancing its performance while maintaining optimal costs.
Create a YAML file with the cluster-level automation configuration using the following template:
apiVersion: perfectscale.io/v1
kind: ClusterAutomationConfig
metadata:
name: cluster-automation-config
spec:
automation:
operational:
stopAllAutomation: false # Global kill switch for automation (default: false)
cleanupAllAutomation: false # Stops automation and reverts all changes, restoring original resource specifications and settings
workloadTypes:
Deployment:
operational:
automationMode: "Enabled" # Enables automation for the workloads with a specific type in the cluster/namespace
restrictions:
workloadMinWasteUSDPerMonth: 5 # Activates automation only if monthly waste exceeds a set threshold (for example, $5)
cpuManagement:
request:
increaseEnabled: true # Allows PerfectScale Automation to increase CPU requests if the performance risks are observed
decreaseEnabled: true # Allows PerfectScale Automation to decrease CPU requests to minimize waste
limit:
keepLimit: true # Automation will maintain a non-zero CPU limit and will not set the value to zero
memoryManagement:
request:
increaseEnabled: true # Allows PerfectScale Automation to increase Memory requests if the performance risks are observed
decreaseEnabled: true # Allows PerfectScale Automation to decrease Memory requests to minimize waste
limit:
increaseEnabled: true # Allows PerfectScale Automation to increase Memory limit if the performance risks are observed
decreaseEnabled: true # Allows PerfectScale Automation to decrease Memory limit
DaemonSet:
operational:
automationMode: "Enabled" # Enables automation for the workloads with a specific type in the cluster/namespace
restrictions:
workloadMinWasteUSDPerMonth: 5 # Activates automation only if monthly waste exceeds a set threshold (for example, $5)
cpuManagement:
request:
increaseEnabled: true # Allows PerfectScale Automation to increase CPU requests if the performance risks are observed
decreaseEnabled: true # Allows PerfectScale Automation to decrease CPU requests to minimize waste
limit:
keepLimit: true # Automation will maintain a non-zero CPU limit and will not set the value to zero
memoryManagement:
request:
increaseEnabled: true # Allows PerfectScale Automation to increase Memory requests if the performance risks are observed
decreaseEnabled: true # Allows PerfectScale Automation to decrease Memory requests to minimize waste
limit:
increaseEnabled: true # Allows PerfectScale Automation to increase Memory limit if the performance risks are observed
decreaseEnabled: true # Allows PerfectScale Automation to decrease Memory limitApply the created configuration by running the following command (where cluster-automation-config.yaml - the name of your file created in the previous step):
kubectl apply -f cluster-automation-config.yamlLet's explore additional examples of automation configurations that offer more granular and flexible control over Automation:
Automation configuration defaults
Some automation configuration settings have predefined defaults. If you don’t specify a value, PerfectScale will automatically apply the default for that field. Below is the list of configurations and their default values.
stopAllAutomation
false
cleanupAllAutomation
false
automationMode
Enabled
workloadLabelSelectors
nil
wasteMaxAutomationFrequency
Deployment: 30m
Rollout: 30m
CronJob: 30m
Job: 30m
DaemonSet: 4h
StatefulSet: 24h
fixResiliencyMaxAutomationFrequency
30m
maintenanceWindowIgnoredForResiliency
false
maintenanceWindowIgnoredMinResiliencyLevel
""
maintenanceWindow
monday:
- "00:00-23:59"
tuesday:
- "00:00-23:59"
wednesday:
- "00:00-23:59"
thursday:
- "00:00-23:59"
friday:
- "00:00-23:59"
saturday:
- "00:00-23:59"
sunday:
- "00:00-23:59"workloadMinWasteUSDPerMonth
5
cpuManagement
request:
IncreaseEnabled: false
DecreaseEnabled: true
MinimumCores: -1 // no limit
MaximumCores: -1 // no limit
limit:
KeepLimit: true
memoryManagement
request:
IncreaseEnabled: false
DecreaseEnabled: true
MinimumGiB: -1 // no limit
MaximumGib: -1 // no limit
limit:
IncreaseEnabled: false
DecreaseEnabled: false
MinimumGiB: -1 // no limit
MaximumGib: -1 // no limit
maxMemoryIncreaseIterations:
Daily: 3
Weekly: 6
Last updated
Was this helpful?