c4i-web
c4i-web
c4i-web
c4i-web
  • Home
  • About Us
    • Our Team
  • Services
    • Mobile Application Development
      • iPhone apps Development
      • Android Apps Development
      • Hire Android Developer
      • iPad application development
    • Cloud Based Application Development
    • Web Development
  • Solutions
    • Cloud Migration
    • Data Center
    • Big Data Analytics
    • Educational Solutions
  • Technologies
    • Java
    • Internet of Things
    • Cloud Computing
    • Data Science
  • Careers
    • Open Positions
  • Blogs
    • Blog

      • Technology
      • SEO
      • Social Media
  • Contact

Create TCP/UDP Internal Load Balancer (ILB) on Google Cloud Platform (GCP) using managed and unmanaged instance groups

Home » Technology » Create TCP/UDP Internal Load Balancer (ILB) on Google Cloud Platform (GCP) using managed and unmanaged instance groups

Creating Internal Load Balancer in Google Cloud Platform is easy and it is used to distribute the load across VM instances. In this guide we will see how to create TCP/UDP Load Balancer using managed and unmanaged instances.

 

Prerequisites:

1) Gcloud SDK must be installed in your local

2) Login to your designated gcp project

3) User or Service Account must have required IAM roles to create ILB

Create TCP/UDP ILB using Managed Instance group

Google’s managed instance group are the group of identical VM instances created using an instance template. These VM instances can be in different zones (regional) but with same region when multi zone is enabled while creating managed instance group(MIG). As by the name managed, this group has some important features like autoscaling, auto-healing, Rolling out updates.

To Create ILB, Follow the below steps sequentially

1) Create Managed Instance group using commandline or GUI or Google deployment manager or rest API

2) Create TCP heath check using below command line

gcloud compute health-checks create tcp <health-check-name> --description="Health check: TCP <port>" --check-interval=5s --timeout=5s --healthy-threshold=2 --unhealthy-threshold=2 --port=<port> --proxy-header=NONE --region=<health-check-region>

3) Create a backed service using below command line

gcloud compute backend-services create <backend-service-name> --load-balancing-scheme internal --health-checks <health-check-name> --protocol tcp --region <backend-service-region>

4) Assign the created managed instance group to the created backend service

gcloud compute backend-services add-backend <backend-service-name> --instance-group <instance-group-name> --instance-group-region=<instance-group-region> --region <backend-service-region>

5) Create a forwarding rule using below command line

gcloud compute forwarding-rules create <forwarding-rule-name> --load-balancing-scheme internal --address <ILB ip address> --ports <port> --subnet <full path of subnet> --region <forwarding rule region> --backend-service <backend-service-name>

Note: Managed instance group, backend service and forwarding rule must be in same region

Create TCP/UDP ILB using Unmanaged Instance group

An unmanaged instance group is a collection of user created/managed VM instances that are created in a same zone, VPC network, and subnet. Unmanaged instances will not have same instance template. We need to manually add user created/managed VM instances into unmanaged instance groups

To Create ILB, Follow the below steps sequentially

1) Assumed User created/managed instances are up and running. Then create Unmanaged instance group using below command line

gcloud compute instance-groups unmanaged create <instance-group-name-1> --zone=<zone1>

gcloud compute instance-groups unmanaged create <instance-group-name-2> --zone=<zone2>

2) Add User created/managed instances to the created instance groups

gcloud compute instance-groups unmanaged add-instances <instance-group-name-1> --instances <instance-name-1>,<instance-name-2> --zone=<zone1>
gcloud compute instance-groups unmanaged add-instances instance-group-name-2> --instances <instance-name-3>,<instance-name-4> --zone=<zone2>

Note: Unmanaged instance group will be created only with same zone instances

3) Verify User created/managed instances are grouped under unmanaged instance group by using below command line

gcloud compute instance-groups unmanaged list-instances <instance-group-name-1> --zone=<zone1>

gcloud compute instance-groups unmanaged list-instances <instance-group-name-2> --zone=<zone2>

4) Create TCP heath check using below command line

gcloud compute health-checks create tcp <health-check-name> --description="Health check: TCP <port>" --check-interval=5s --timeout=5s --healthy-threshold=2 --unhealthy-threshold=2 --port=<port> --proxy-header=NONE --region=<health-check-region>

5) Create a backed service using below command line

gcloud compute backend-services create <backend-service-name> --load-balancing-scheme internal --health-checks <health-check-name> --protocol tcp --region <backend-service-region>

6) Assign the created unmanaged instance groups to the created backend service

gcloud compute backend-services add-backend <backend-service-name> --instance-group <instance-group-name-1> --instance-group-zone <instance-group-zone-1> --region <backend-service-region>

gcloud compute backend-services add-backend <backend-service-name> --instance-group <instance-group-name-2> --instance-group-zone <instance-group-zone-2> --region <backend-service-region>Create a forwarding rule using below command line

7) Create a forwarding rule using below command line

gcloud compute forwarding-rules create <forwarding-rule-name> --load-balancing-scheme internal --address <ILB ip address> --ports <port> --subnet <full path of subnet> --region <forwarding rule region> --backend-service <backend-service-name>

Note: Unmanaged instance group, backend service and forwarding rule must be in same region

Contents

515
Technology
Prev PostHTTP Liveness and Readiness Probe in Kubernetes Deployment
Next PostC4I Technologies INC Named Best Managed IT Service Provider in Houston by Digital.com

Related items

Technology

HTTP Liveness and Readiness Probe in Kubernetes Deployment

Liveness and Readiness probes are required in Kubernetes to prevent deadlock of your appli

430
Technology

Configure Pod Anti-affinity and Pod Disruption Budget in Kubernetes deployment for High availability

High availability (HA) is the ability to make our application continuously operational for

403
c4i-web
We are on a mission to energize everyone to embrace technology for profitable employment.
Contact Us
Corporate Office
26606 Cook Field Rd Suite 400 Katy TX-77494
713-565-1199
346-447-6884
Hyderabad
Hyderabad
Spacion Business Centre, Level 5, Spacion Towers, HITEC City, Hyderabad, Telangana 500081
+91 836 737 5363
Copyright © 2021. All Rights Reserved.