google-cloud-platformautoscalinggcp-load-balancergoogle-cloud-compute-engine

Auto Scaling Without Load Balancer in GCP


Can someone help me with GCP autoscaling. I want to achive Auto Scaling Without using Load Balancer in GCP because the service which is running on the VM does not need any endpoint its more likely a kafka consumer where its only fetch the data from cluster and send it to DB so there is no load balancing.

so far i have successfully created instaces template and have define the minimum and maximum state there but thats only maintaining the running state not perfroming autoscaling.


Solution

  • You can use instance groups which is a collection of virtual machine (VM) instances that you can manage as a single entity.

    Autoscaling groups of instances have managed instance groups which will autoscale as per requirement by using the following policies.

    1. CPU Usage: The size of the group is controlled to keep the average processor load of the virtual machines in the group at the required level
    2. HTTP Load Balancing Usage: The size of the group is controlled to keep the load of the HTTP traffic balancer at the required level
    3. Stackdriver Monitoring Metric: The size of the group is controlled to keep the selected metric from the Stackdriver Monitoring instrument at the required level .
    4. Multiple Metrics: The decision to change the size of the group is made on the basis of multiple metrics.

    Select your required policy and create a managed group of instances which will autoscale your VM.Here in this document you can find the steps to create scaling based on CPU usage, similarly you can create a required group.

    For understanding attaching a Blog refer to it for more information.