---
title: Advanced Load Balancing and Clustering in GCP
description: "## GCP Clustering Overview This article describes how to set up **advanced load balancing and high availability** using the **RELIANOID Load Balancer** in **Google Cloud Platform (GCP).** We’ll demonstrate the full process of deploying and configuring a **RELIANOID Cluster** with…"
url: "https://www.relianoid.com/resources/knowledge-base/howtos/advanced-load-balancing-and-clustering-in-gcp/"
updated: "2025-10-28"
category: "Howto's"
---

# Advanced Load Balancing and Clustering in GCP

## GCP Clustering Overview

This article describes how to set up **advanced load balancing and high availability** using the **RELIANOID Load Balancer** in **Google Cloud Platform (GCP).**
 We’ll demonstrate the full process of deploying and configuring a **RELIANOID Cluster** with a **virtual IP (VIP)** for failover and a **farm of backend servers** for HTTP load balancing.
 The objective is to ensure that if one node (master) fails or reboots, the virtual IP and services automatically fail over to the secondary node, providing uninterrupted application availability.

## Cloud Load Balancer Clustering Environment

We are going to demonstrate how it can be implemented in **Google Cloud Platform (GCP)** using native GCP services. The following diagram illustrates the architecture we aim to deploy a web load balancing setup using **RELIANOID Application Delivery Controller** in GCP for high availability and failover.

### Architecture Diagram

[![reliadnoid load balancer cluster schema in GCP](https://static.relianoid.com/wp-content/uploads/2025/10/relianoid_lb_cluster_gcp.webp)](https://static.relianoid.com/wp-content/uploads/2025/10/relianoid_lb_cluster_gcp.webp)

Each RELIANOID VM will be configured with one **network interface (nic0)** connected to a **VPC network** and assigned both an **internal** and a **static external IP.**

- LB1:
- LB2:

An additional **secondary internal IP (VIP)** will be created on LB1’s network interface:

- VIP (for Virtual Service):`10.0.1.11`

The **backend servers** (real applications) are deployed in the same private network (`10.0.1.0/24`) and are **not directly exposed to the Internet.**

## Implement Cloud Load Balancer Clustering in GCP

### 1. Deploy RELIANOID Load Balancer Instances

You can deploy the RELIANOID Load Balancer image directly from the **Google Cloud Marketplace.**

1. Go to **Google Cloud Console → Compute Engine → VM Instances → Create Instance.**
2. Select the **RELIANOID Load Balancer image** under “Custom images” then “Marketplace”.
3. Configure:

- **Machine type:** e2-micro (sufficient for testing; use n2-standard for production)
- **Region / Zone:** same region for both nodes
- **Network Interface:**
- **Firewall:**Allow TCP 22 (SSH), TCP 444 (Web GUI), and TCP 80 (for HTTP services).

 Click **Advanced options → Security → Access Scopes**

- Choose **Allow full access to all Cloud APIs**or **set custom service account**(recommended).
- Assign a **Service Account**with `Compute Admin`and `Compute Network Admin`roles.

Deploy both nodes (LB1 and LB2) in the same VPC and subnet.

### 2. Enable and Configure Service Accounts (Identity Access)

RELIANOID uses the **Google Cloud API** for failover management, similar to Azure Managed Identities.

- Go to **IAM & Admin → Service Accounts.**
- Create a **new service account** named `relianoid-cluster-sa.`
- Assign the following roles:

Attach this **service account** to **both LB1 and LB2** VMs (edit → change service account).

Then verify access from each node:

```
sudo systemctl status google-guest-agent
gcloud auth list
gcloud projects get-iam-policy <YOUR_PROJECT_ID>
```

If the agent is not installed, run:

```
sudo apt-get install google-cloud-sdk google-compute-engine
```

### 3. Configure Network Interfaces and Virtual IP

In GCP, secondary internal IPs can be added manually via the Console or CLI.

**On LB1 (Master Node):**

- Go to **VPC Network → VM instances → LB1 → Edit → Network Interface → Add Secondary Internal IP**
- Assign:

**On LB2 (Backup Node):**

- Do not assign this secondary IP.
- The RELIANOID cluster service will automatically reassign it during failover.

### 4. Security Rules (Firewall Configuration)

In **VPC Network → Firewall,** create rules to allow:

| Protocol | Port | Purpose |
| --- | --- | --- |
| TCP | 22 | SSH access |
| TCP | 444 | Web GUI |
| TCP | 80 | Backend HTTP services |

Apply these rules to instances tagged as `relianoid-lb.`

### 5. Activate the RELIANOID License

Access each node:

- **LB1:**`https://34.122.145.90:444`
- **LB2:**`https://35.233.210.70:444`

Use:

- Username: `root`
- Password:*Instance ID*

Retrieve hostname and certificate key → Visit
 [https://www.relianoid.com/activate-enterprise-edition-cloud-evaluation/](https://www.relianoid.com/activate-enterprise-edition-cloud-evaluation/)
 Upload the downloaded `.pem` license file to each node.

### 6. Configure RELIANOID Cluster

From **LB1 Web GUI → System → Cluster,** fill out:

| Field | Value |
| --- | --- |
| Local IP | Select nic0 (10.0.1.9) |
| Remote IP | 10.0.1.8 |
| Remote Node Password | (LB2 instance ID) |

[![relianoid load balancer cluster configuration with gcp](https://static.relianoid.com/wp-content/uploads/2025/10/relianoid_cluster_configuration_with_gcp.webp)](https://static.relianoid.com/wp-content/uploads/2025/10/relianoid_cluster_configuration_with_gcp.webp)

Click **Generate.**

LB1 becomes **Master,** LB2 becomes **Slave** automatically.

## Create a load balancing service in GCP

Now, let’s configure a simple web load-balancing farm.
 Go to:
 **LSLB → Farms → Create Farm**

Parameters:

- **Farm Name:**webfarm
- **VIP:**`10.0.1.11`
- **Port:**`80`
- **Algorithm:**Round Robin
- **Persistence:**Source IP (60 sec)
- **Health Check:**`check_tcp`

Add backend servers:

- **Backend 1:**`10.0.1.20:80`
- **Backend 2:**`10.0.1.21:80`

Apply configuration.

Now access the virtual service at:

`http://34.172.119.80/`

Traffic will be distributed between your backend servers via the RELIANOID cluster.

To test failover:

- Reboot the master node (LB1).
- Observe that LB2 becomes active, taking control of the VIP (10.0.1.11).
- Connection through public IP remains uninterrupted.

## Troubleshooting: This Host Has Not Assigned a Service Account

If you receive the message:

    "This host has not assigned a Service Account. Please configure it in GCP console"

It indicates the GCP **service account** is not configured or the **Google Guest Agent**is missing.

To verify:

```
sudo systemctl status google-guest-agent
gcloud auth login --brief
gcloud auth print-access-token
```

If the agent or SDK is missing:

```
sudo apt-get install google-cloud-sdk google-compute-engine
```

Ensure that:

- The instance has a valid **Service Account** attached.
- The **Service Account** has the **Compute Admin** and **Network Admin** roles.

### Enjoy Advanced Load Balancing and Clustering in GCP with RELIANOID!

### 📄 Download this document in PDF format
