Creating a Developer and Production environment on Google Cloud Platform

Milind Rastogi
7 min readSep 4, 2020

In this article I will be creating a developer and production environment on Google cloud by using many GCP services like GKE, LoadBalancer , SQL etc.

In a company or an organization multiple team works in parallel , for example we have one team as a Developer which and another team is a testing team and we also have a production team. So after the code is developed by development team then the code is transferred to the testing team. After successfully testing the code by testing team the code is then send to the production team. This team will finally launch the product to the real world by hosting their application on production server. And the clients can access their application from the production server.

So in this article I will be creating the developer and production environment by accessing many GCP services.

Now let me explain what we will be doing by using many GCP services

What we will be doing ?

1. Create multiple projects named as developer and production

2. Create VPC network for both the projects

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

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

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

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

Now before doing the hands on part let’s first get to know what tools and gcp services we are using.

Google Kubernetes Engine (GKE)

Google Kubernetes Engine is the service used for managing our Kubernetes cluster on cloud. GKE act as a managed Kubernetes as a Service. We can create fully managed Kubernetes cluster on GCP anywhere in the world.

Virtual Private Network(VPC)

Virtual Private Cloud (VPC) provides networking functionality to Compute Engine virtual machine (VM) instances, Google Kubernetes Engine (GKE) clusters, and the App Engine flexible environment. VPC provides networking for your cloud-based resources and services that is global, scalable, and flexible.

VPC act as the virtual setup for the networking lab created by many companies. Earlier companies buy physical networking hardware like routers , switches etc and then manually setup these tools to create there Private network. But with the advancement in the technologies this Private Network lab can be setup virtually on cloud and that’s the reason it is called as Virtual Private Network.

VPC Network Peering

VPC is a private network so it will not be able to any public client in a public network. But if we want to connect two private network or two VPC’s then we have to use some technique or service for proper connection between the two. This service is known as VPC Network peering.

Google Cloud VPC Network Peering allows internal IP address connectivity across two Virtual Private Cloud (VPC) networks regardless of whether they belong to the same project or the same organization.

Google Cloud SQL

It is a fully managed relational database service for MySQL, PostgreSQL, and SQL Server.

Now let’s directly move on to the hand’s on part.


  1. You should have a GCP account with a valid credit/debit card attached or if you don’t have a GCP account then you can also use google qwiklab credits for using GCP services.
  2. You should have installed gcloud SDK .

Step 1

Creating a developer and production project and their VPC

As I will be using GCP on qwikilabs so I won’t be able to create more than 1 projects on GCP. So I will be doing the practical on the by default project.

Now go to VPC Network in GCP for creating VPC

VPC network

Create a new VPC network and give the required details like vpc and subnet name.

Now fill the region and IP range for the vpc

The developer vpc is created and now give the firewall rules to the vpc for the proper networking.

After creating the developer vpc now let’s also create the production vpc.

We will be creating the production vpc in the us-east1 data center so fill the details accordingly.

Finally the production vpc is also created , now let’s give some firewall rules to the vpc

So finally, both the vpc’s are created.

Step 2

Creating a link between the two VPC (VPC Peering)

We will be linking the production and developer vpc using the vpc peering service. First we will create both the production and developer peering connection after that we will connect these two peerings.

We can see that both the vpc’s are now connected

Step 3

Creating database instance on production vpc

For using GCP’s database service we have to use GCP’s SQL service.

We will be using MySql database so select that database.

Now let’s create MySQL instance. Give the instance id and the password. We will be creating this instance in production vpc so select the us-east1 data center as a region.

After creating the SQL instance add a new network under Connection section for connecting the database to our website.

Finally the database is created!

Now create you own databse from the databases section.

For logging into the database we will be using the cloud shell. Wrote the below command for accessing the database.

Step 4

Creating a Kubernetes cluster using GKE service

For creating the kubernetes cluster we will be using the GKE(Google Kubernetes Engine) service. Now let’s create the kubernetes cluster.

As we will be creating the cluster in developer vpc so give the region as asia-southeast1 which is the region name of data center of Singapore.

Give the number of nodes per zone to be launched.

Select the instance type to be launched in all the nodes.

In the network section select the developer vpc i.e. vpcdev

After doing all the configurations for creating a Kubernetes cluster ,we can see that after some time 3 nodes of insctances will be launched in three different Availability Zones. For accessing the kubernetes service through your local command line use the below command for configuring your kubectl.

kubectl is configured

For deploying wordpress on our kubernetes cluster we can run the following commands

kubectl create deployment mywp --image=wordpresskubectl scale deployment mywp --replicas=5kubectl get pods -o wide

For exposing our deployment and creating a load balancer use the below command

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

Connect the wordpress website using the ip of the database.

Now enter the Username and password for logging into the wordpress

Finally our wordpress is deployed which is connected to the mysql database in the backend!

Thank you for reading my article!

Please clap , share and give your valuable comments if you like my article.