Deployment of Web Application (Drupal) with Cloud SQL on Google Cloud Platform

Mukul Jeveriya
5 min readSep 19, 2020

Task Description

Step1). Create multiple projects namely developer and production

Step2). Create VPC network for both the projects

Step3). Create a link between both the VPC networks using VPC Peering

Step4). Create a Kubernetes Cluster in developer project and launch any web application with the Load balancer

Step5). Create a SQL server in the production project and create a database

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

Let’s go….


I create two project as mention in the task is named as production-team and another one is developer-team.


As same i create for developer-team.

After creating any project we have to enabling Compute Engine API to Creates and runs virtual machines on Google Cloud Platform for this we have to go as i mention

navigate menu-->APIs & service-->library--> Compute Engine API

Step 2:-

VPC (Virtual Private Cloud) is managed networking functionality for our GCP resources.

So creating VPC for our both project firstly we are going to create VPC for developer team.

For creating vpc
navigate menu-->VPC network-->create vpc network
then follow images

Now we create VPC for production team

I make subnet public so our website accessible by our client.

Now add firewall rule for developer VPC and as well as production VPC

For adding firewall rules for vpc
navigate menu-->VPC network-->firewall-->create firewall rule
then follow image

Now create firewall rule for production.

Now publically both vpc has connectivity.

Step 3:-

Google Cloud has their internal private network so Google Cloud VPC Network Peering allows internal IP address connectivity across two Virtual Private Cloud (VPC) networks, whether they belong to the same project or not.

Creating peering connection on developer VPC side.

After creating vpc you saw its inactive because we have to peer with both the sides
For creating VPC network peering
navigate menu-->VPC network-->vpc network peering-->create peering
then follow image

Now Creating peering connection on production VPC side.

Now you saw VPC peering is active in production as well in developer project
Active VPC peering on both the side

Now we are ready to use google private network for connectivity.


Now time to create a k8s cluster in developer project

For creating cluster
navigate menu-->kubernetes engine-->clusters-->create cluster
than follow the image

I launch this cluster in all subnet .And take the size of all node is 1.So in each subnet one-one node is launched. all set just create it.

Step 6:-

Now we have to create a database so i create a SQL database

For creating sql database
navigate menu-->sql-->create instance
than choose your database and follow the image

For connectivity we have to add some network so

Edit configuration and go to connectivity section and add network as show in image

All set our cluster create our Database create now time to action just create a deployment of our website Drupal.

For this we run command on cloud shell or can download gcloud on system and run all these command on terminal

our cloud shell working good

now create deployment

kubectl create deployment "deplyment name" --image="image name"

I launch deployment as website and image using Drupal after hit enter deployment create now just expose the pod

kubectl expose deployment website --type=LoadBalancer --port=80

All done now we just one step behind to get public ip just run command

kubectl get services

We get the external IP by which we connect to our website and also you can see a load balancer is launch in GCP cloud.

step 6:-

Time to go our website and configure it

Drupal configure and launch successfully.

Now our Drupal launch on the Google cloud platform and have connectivity with mysql database. I learn a lot while i was doing this task its a great experience.

Thank for reading!!!