Deploying Wordpress on GCP using GKE
Rahul Kumar
DevOps Engineer || 3x GCP Certified || DevOps || Docker || kubernetes || OpenShift || Ansible || Jenkins || AWS || Terraform || Immediate joiner
Google Cloud
Google Cloud Platform (GCP), offered by Google, is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search, Gmail, file storage, and YouTube. Alongside a set of management tools, it provides a series of modular cloud services including computing, data storage, data analytics and machine learning. It also provides infrastructure as a service, platform as a service, and serverless computing environments.
Pre-requisites:
1) Google Cloud Account
2) gcloud command line tool
Project Description:
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
Steps:
The first part is creating 2 projects- DevProject and ProdProject.
ProdProject
1) The first step is creating a VPC.
2) Next Step is creating an SQL instance. We have to select which database we want to use.
3) Give a proper Name and Description.
4) Select Region and Zone.
5) Select the appropriate Database version.
6) Under the configuration option and select the network.
7) Then Create. The Database will be created.
DevProject
1) Like ProdProject the first step is creating the VPC.
2) The 2 VPCs are created but there is no connection between them. For this VPC peering is used.
3) Since the VPC is created, Kubernetes cluster creation can be started. For this GCP provides us with GKE(Google Kubernetes Engine).
3) Create the cluster.
4) Once the cluster is created execute this command on cmd.
gcloud container clusters get-credentials cluster-1 --region asia-southeast1 --project devproject-287316
This will update the kube config and kubectl will be configured automatically.
5) Now do deploy wordpress a kubernetes manifest file is needed. The file used here is:
6) Now start the build using this command.
kubectl create -f <manifest-file-name>.yml
Wordpress is now accessible. Navigate to the external IP on browser.