Creating Multi-node K8s on top of GCP

Creating Multi-node K8s on top of GCP

TASK DETAILS :

1. Create multiple projects namely 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

About Wordpress :

WordPress is software designed for everyone, emphasizing accessibility, performance, security, and ease of use. We believe great software should work with minimum set up, so you can focus on sharing your story, product, or services freely. The basic WordPress software is simple and predictable so you can easily get started. It also offers powerful features for growth and success.

We believe in democratizing publishing and the freedoms that come with open source. Supporting this idea is a large community of people collaborating on and contributing to this project. The WordPress community is welcoming and inclusive. Our contributors’ passion drives the success of WordPress which, in turn, helps you reach your goals.

No alt text provided for this image

Prequisites :

  • Google Cloud Platform (GCP)
  • Kubernetes , K8s CLi and Kubectl
  • Sql
  • Gcp Cli

So here we Start ,

Step 1. Create multiple projects namely developer and production

Sign in to GCP console and click on

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

Step 2. Create VPC network for both the projects

Go to Networking Services -> VPC Networks -> Click on Create VPC Network

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

we can change Name ,subnet name, region and ip address range according to your prefrence

and i choose singapore region (asia-southeast1).

Now repeat same steps on developer side as well.

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

Go to Networking Services -> VPC Networks -> VPC network peering-> Click on Create peering connection ->Click on Continue

No alt text provided for this image

in my case name ,vpc network name, projectid is this but it can varies acc. to your prefrence

you can get project id from clicking on top .

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

Go to Kubernetes Engine -> Clusters -> Create Cluster

a. Click on Cluster basics and and write name of your cluster ,select location and Master version of according to your prefrence

No alt text provided for this image

then click on default-pool and select node details

No alt text provided for this image

then click on node and configure your node basics

No alt text provided for this image

then click on create and within 10-15 minutes your cluster is ready

No alt text provided for this image

and to connect to your cluster click on connect and copy command line access command for your cluster and run this command in windows command prompt

gcloud container clusters get-credentials drlcluster --region asia-southeast1 --project developer-280520

now to create a deployment for an application i choose wordpress run cmd:->

kubectl create deploy drllb --image=wordpress

to expose it use cmd:->

kubectl expose deploy drllb --type=LoadBalancer --port=80

to see external ip of exposed delpoyment run cmd:->

kubectl get services

now copy ip address and browse that ip address to check that load balancer is working or not.

No alt text provided for this image


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

Now Open Project Production and follow given steps to create database in mysql

Storage -> SQL ->Create instance ->Choose database type

No alt text provided for this image

fill the delatials for data base and and connectivity part use this to create a firewall rule helps you to connect with the instance easily but is is not safe for critical database

No alt text provided for this image

then click on create to create database instance

now click on instance-> Database section and create database according to your prefrence

No alt text provided for this image

now database created and ready to use now open wordpress installation and fill the details.

No alt text provided for this image

now wordpress is successfully connected with database services in gcp and it is ready to use.

Thank You For investing your time to read this

this work is done under Mentorship Of Mr. Vimal Daga Sir and in the workshop which is organised by Linux World Informatics Pvt.Ltd.









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

Divya Raj Lavti的更多文章

社区洞察

其他会员也浏览了