GKE - SQL cluster using GCP

GKE - SQL cluster using GCP

In this article we are going to perform one industry need task. So lets first look at the task we are going to do.

❗Task Details :❗

1. Create multiple VPC developer and production inside one project. (You can also create two project and one VPC among them).

2. Create a link between both the VPC networks using VPC Peering.

3. Create a Kubernetes Cluster in developer VPC and launch any web application with the Load balancer.

4. Create a SQL server in the production VPC and create a database.

5. Connect the SQL database to the web application launched in the Kubernetes cluster.

Step -1 : Create two VPC inside one project.

No alt text provided for this image

Inside networking you can find VPC network go there.

Here you have to create two different VPC inside two different regions, one for development and one for production.

Click on create a new VPC. There you have to fill the details. Enter your VPC and subnet name and launch inside any region. Here you have to give range of private IP you need inside cluster.

No alt text provided for this image

Same way we have to create other VPC.

No alt text provided for this image

Step-2 Create a link between both the VPC networks using VPC Peering.

For connecting both VPC we are using one of the famous concept of google cloud known as VPC Peering.

Why we need to use VPC Peering ?
By default VPC provides you isolated environment, so you can not connect between two VPC. But in this practical we have to do this somehow. So there is only one way to doing this is VPC peering.

So, lets create VPC peeering.

Ummm you have done perfectly still it is showing to inactive?? So what to do ?

No alt text provided for this image

Here when you create a VPC peering it is requesting to the other project VPC or same VPC so, they have to allow this.

For this we have to create same VPC peering request inside other VPC and now it is showing active.

No alt text provided for this image

Step-3: Create a Kubernetes Cluster in developer project and launch any web application with the Load balancer.

Here you have to just launch your cluster and behind the seen it will launch complete kubernetes cluster for you.

By default it will create three nodes.

No alt text provided for this image
No alt text provided for this image

If you have done successfully it will show something like this in few moments.

You can connect to this cluster using that connect button and you can use cloud shell for connectivity.

Now you have to launch pods inside cluster. We are using wordpress as a frontend.

No alt text provided for this image

Step-4: Create a SQL server in the production VPC and create a database

No alt text provided for this image

Here GCP provides you fully managed database service. It is known as SQL. You just hav to go there and choose your service. Here we are going with mysql.

Enter your instance name root user password for connectivity of database and select your region.

Now in just click it will launch and configure this or you.

Here you do not have to worry about managing and configuring the cluster.


Create a new database for you inside instance database.

You have to also change database access to the public.

Step-5: Connect the SQL database to the web application launched in the Kubernetes cluster.

Now you can use this credentials and inside wordpress give this. So your wordpress is now connected to the MYSQL.

No alt text provided for this image

So lets create some pages and look how this will work.



No alt text provided for this image

Now you can create many pages such like this. It will store this data inside mysql cluster and fetch it from cluster when user access the site.



Thanks for watching, hope this article will help you!!

To view or add a comment, sign in

More articles by Akshit Modi

  • Azure Cloud Service with Kubernetes

    What is Kubernetes? Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and…

  • Case Study of Neural Networks

    What is Neural Networks? Neural networks, also known as artificial neural networks (ANNs) or simulated neural networks…

    1 Comment
  • Connecting VM and Cloud Instances using JuiceSSH from mobile

    I am damn sure many times you have think to connect your laptop from mobile. In this blog we are going to use our EC2…

    1 Comment
  • How Directive Gaming Use AWS to solve their use-cases

    Directive Games is a mobile game start-up established in 2014, is headquartered in Hong Kong and has offices at…

  • Why Big Data became a Problem?

    If you are looking for Data consumption by top companies and problem with Big Data then this blog is for you. "Over 2.

    3 Comments
  • Creating an App using flutter

    I was working on a task - make an App with Audio - Video Task description - Flutter App Development 1.Create a flutter…

    1 Comment
  • AWS using Terraform

    Task - Deatils Have to create/launch Application using Terraform 1. Create the key and security group which allow the…

  • AWS - EKS Final Project

    Why to use EKS? EKS is one of the service of aws. AWS provides all his internal services when you use eks.

  • OpenStack set up in your system

    OpenStack is a private cloud. It is open-source and you can get a different flavor from different company's.

  • File System - inode table

    Why we did not get complete resources in our devices? Why copy takes a long time and move takes less time? Problems…

Others also viewed

Explore content categories