Deployment of WordPress and MySQL in GCP through VPC peering along with Kubernetes Cluster

Deployment of WordPress and MySQL in GCP through VPC peering along with Kubernetes Cluster

Before I start briefing about my Project, let me introduce you to the following terms:-

VPC (Virtual Private Cloud) :-

No alt text provided for this image

A VPC is a public cloud offering that lets an enterprise establish its own private cloud-like computing environment on shared public-cloud infrastructure. A VPC gives an enterprise the ability to define and control a virtual network that is logically isolated from all other public cloud tenants, creating a private, secure place on the public cloud.


Subnets :-

No alt text provided for this image

Subnetwork or subnet is a logical subdivision of an IP network. The practice of dividing a network into two or more networks is called subnetting. GCP provides two types of subnetting one is Public which allow the internet to access the machine and another is private which is hidden from the internet.

VPC Peering

No alt text provided for this image

A VPC peering connection is a networking connection between two VPCs that enables you to route traffic between them using private IPv4 addresses or IPv6 addresses. Instances in either VPC can communicate with each other as if they are within the same network. You can create a VPC peering connection between your own VPCs, or with a VPC in another GCP account. The VPCs can be in different regions (also known as an inter-region VPC peering connection).


KUBERNETES

No alt text provided for this image

Kubernetes is a popular open source platform for container orchestration — that is, for the management of applications built out of multiple, largely self-contained runtimes called containers. Containers have become increasingly popular since the Docker containerization project launched in 2013, but large, distributed containerized applications can become increasingly difficult to coordinate. By making containerized applications dramatically easier to manage at scale, Kubernetes has become a key part of the container revolution.

No alt text provided for this image

So that was all about the introduction of topics that are included in my project.

No alt text provided for this image
  • Create a project called devproject.


No alt text provided for this image
  • The project has been created.


No alt text provided for this image
  • Project can be created by launching cloud shell too.


No alt text provided for this image
  • Command to list the projects and available services.


No alt text provided for this image
  • Now launch a VM instance.


No alt text provided for this image
  • Check whether the Cloud API is enabled or not.


No alt text provided for this image
  • Launch a VM instance in devproject.


No alt text provided for this image
  • Choose an image and respective Hard-disk.


No alt text provided for this image
  • The OS has been launched. Here I have launched my OS in Singapore region.


No alt text provided for this image
  • Now install apache software through cli.


No alt text provided for this image
  • For ssh, create a firewall allowing instances and ingress traffic.


No alt text provided for this image
  • Firewall has been created.


No alt text provided for this image
  • Notice the external IP.


No alt text provided for this image
  • Now create a Subnet and give an IP range.


No alt text provided for this image
  • Create a prod project.


No alt text provided for this image
  • Create a VPC Peering


No alt text provided for this image
  • Attach your VPC running in another project.


No alt text provided for this image
  • VPC peering has been created and established. The status is Active now from Both ends. VPC peering should be done from both the projects otherwise it will show pending state.


No alt text provided for this image
  • Notice you can ping the private IPs of another project. This is so cool!!


No alt text provided for this image
  • You can test for ssh too using command line. For that you need to first download the putty and gcloud.


No alt text provided for this image


  • Now create a Kubernetes Cluster enabling regional Locations.


No alt text provided for this image
  • The Kubernetes Cluster has been deployed.


No alt text provided for this image
  • To get the command line access, run the command that is mentioned.


No alt text provided for this image
  • You can now check for pods in cli.


No alt text provided for this image
  • Now create a Deployment and launch containers. Here i have used a webserver php image. You can check for pods and nodes and even create a replica of pods.


No alt text provided for this image


  • Now time to deploy Load balancers. In Kubernetes world, Load-balancers are known as services.


No alt text provided for this image
  • You can check whether the Load Balancer is active or not by the external IP mentioned in cli.


No alt text provided for this image
  • Choose a Database. In my case, i will use MySQL database in my Prod Project


No alt text provided for this image
  • Fill the credentials and create MySQL.


No alt text provided for this image
  • Now we are inside our MySQL database.


No alt text provided for this image
  • Create a database.


No alt text provided for this image
  • The services of Load Balancers, wordpress and MySQL has been deployed.


No alt text provided for this image
  • Launch the wordpress by filling the following Credentials.


No alt text provided for this image
  • We are now inside the wordpress.


No alt text provided for this image
  • Create an App engine.


No alt text provided for this image
  • Deploy your app by using the following command and connect it to the database.


No alt text provided for this image
  • The application has been launched successfully in the Kubernetes cluster.


No alt text provided for this image
  • I have deployed the following application and connected it with my database. This marks the successful completion of the given Project.






Neha Gupta

Custom Software Engineering Senior Analyst at Accenture

4 年

Super cool????

Nithish Kumar

Aspiring DevOps/Cloud Engineer | 2x RedHat certified | Docker | Kubernetes | Jenkins | Ansible | Terraform | AWS Cloud | Python | Openshift | Podman | RedHat Linux

4 年

Well Done ??

要查看或添加评论,请登录

NIRBHAY MAITRA的更多文章

社区洞察

其他会员也浏览了