Deployment of WordPress and MySQL in GCP through VPC peering along with Kubernetes Cluster
NIRBHAY MAITRA
Full-stack Developer at Mobius by Gaian with expertise in React.js, Node.js and MongoDB
Before I start briefing about my Project, let me introduce you to the following terms:-
VPC (Virtual Private Cloud) :-
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 :-
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
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
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.
So that was all about the introduction of topics that are included in my project.
- Create a project called devproject.
- The project has been created.
- Project can be created by launching cloud shell too.
- Command to list the projects and available services.
- Now launch a VM instance.
- Check whether the Cloud API is enabled or not.
- Launch a VM instance in devproject.
- Choose an image and respective Hard-disk.
- The OS has been launched. Here I have launched my OS in Singapore region.
- Now install apache software through cli.
- For ssh, create a firewall allowing instances and ingress traffic.
- Firewall has been created.
- Notice the external IP.
- Now create a Subnet and give an IP range.
- Create a prod project.
- Create a VPC Peering
- Attach your VPC running in another project.
- 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.
- Notice you can ping the private IPs of another project. This is so cool!!
- You can test for ssh too using command line. For that you need to first download the putty and gcloud.
- Now create a Kubernetes Cluster enabling regional Locations.
- The Kubernetes Cluster has been deployed.
- To get the command line access, run the command that is mentioned.
- You can now check for pods in cli.
- 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.
- Now time to deploy Load balancers. In Kubernetes world, Load-balancers are known as services.
- You can check whether the Load Balancer is active or not by the external IP mentioned in cli.
- Choose a Database. In my case, i will use MySQL database in my Prod Project
- Fill the credentials and create MySQL.
- Now we are inside our MySQL database.
- Create a database.
- The services of Load Balancers, wordpress and MySQL has been deployed.
- Launch the wordpress by filling the following Credentials.
- We are now inside the wordpress.
- Create an App engine.
- Deploy your app by using the following command and connect it to the database.
- The application has been launched successfully in the Kubernetes cluster.
- I have deployed the following application and connected it with my database. This marks the successful completion of the given Project.
Custom Software Engineering Senior Analyst at Accenture
4 年Super cool????
??Great work
Aspiring DevOps/Cloud Engineer | 2x RedHat certified | Docker | Kubernetes | Jenkins | Ansible | Terraform | AWS Cloud | Python | Openshift | Podman | RedHat Linux
4 年Well Done ??