gcp setting load balancer (application) to instance group
Assuming that you have an existing instance group setup. Now, you would like to setup application load balancer to route traffic to your autoscaling vms.
Goto Network Service -> create load balancer. Select application load balancer.
Then select "public facing or internal".
And then select regional load balancer.
And then select configure load balancer and next you will setup front-ends. Provide a name and select network tier. I am using standard for this.
Next create your backend services. This is where you configure which VMs you would like to route traffic to.
And i have given it a name and select target backend type to be instance group.
Next, we will configure the followings.
You maybe asked to reserve a subnet for the load balancer. Depending on which VPC network you have chosen, you need to ensure it does not overlap with existing subnet already defined in your VPC.
And then you would need to configure target scaling group and healthchecks
For the routing rules, i am using simple host and path rule.
And then click on create.
Once it has been created, we can proceed to test by getting the ip address of the load balancer and load it up in your browser. Before this you may need to setup nginx on your vms.
Comments