More Info:
Ensure that cluster autoscaling profile is set to OPTIMIZE_UTILIZATION or BALANCED for optimal resource utilizationRisk Level
MediumAddress
Performance Efficiency, Operational Excellence, Reliability, SecurityCompliance Standards
CBPTriage and Remediation
Remediation
Using Console
Using Console
To remediate the Autoscaling Profile for Clusters misconfiguration in GCP using GCP console, follow these steps:
- Open the GCP console and navigate to the Kubernetes Engine page.
- Select the cluster that you want to remediate.
- Click on “Edit” button at the top of the page.
- In the “Node pools” section, click on the name of the node pool that you want to remediate.
- Scroll down to the “Autoscaling” section and click on “Edit”.
- In the “Autoscaling mode” section, select either “Optimize utilization” or “Balanced” depending on your requirements.
- Click on “Save” to apply the changes.
Using CLI
Using CLI
To remediate the misconfiguration “Autoscaling Profile For Clusters Should Be Set To Optimize_Utilization or Balanced” for GCP using GCP CLI, you can follow the below steps:Step 1: Open the Cloud Shell in your GCP console.Step 2: Run the following command to list all the existing node pool configurations in the cluster:Step 3: Choose the node pool for which you want to set the autoscaling profile.Step 4: Run the following command to set the autoscaling profile to “optimize-utilization”:ORRun the following command to set the autoscaling profile to “balanced”:Note: Replace This should return either “optimize-utilization” or “balanced” depending on which profile you chose to set.By following these steps, you can remediate the misconfiguration “Autoscaling Profile For Clusters Should Be Set To Optimize_Utilization or Balanced” for GCP using GCP CLI.
<cluster-name>
and <node-pool-name>
with the actual names of your cluster and node pool respectively.Step 5: Verify that the autoscaling profile has been set correctly by running the following command:Using Python
Using Python
To remediate the misconfiguration “Autoscaling Profile For Clusters Should Be Set To Optimize_Utilization or Balanced” in GCP, you can follow the below steps using Python:This will update the autoscaling configuration for the specified GCP cluster with the desired profile.
- Import the required libraries:
- Set the project ID, region, and cluster name:
- Create a client object:
- Get the current cluster configuration:
- Update the autoscaling configuration with the desired profile:
- Update the cluster configuration: