Solution To Set up and Configure a Cloud Environment : Challenge Lab

Solution To Set up and Configure a Cloud Environment : Challenge Lab

Disclaimer: Please this blog was meant for those who have gotten stuck whilst taking the third challenge lab on the Qwiklabs Platform. You can also read this before you take the lab too, no problem, but please do keep in mind you’ve to understand all the concepts as you go through the lab.

Let’s set the ball rolling

TASK 1: Create development VPC manually.

Step 1: Go to Navigation Menu. Scroll down and find VPC Network.
Step 2: In VPC Network, click on Create VPC Network and then enter following details:

VPC Name: griffin-prod-vpc

Subnet : griffin-prod-wp
Region : us-east1
IP address ranges :
Click Add Subnet…
Subnet : griffin-prod-mgmt
Region : us-east1
IP address ranges :
Step 3: click Create.

TASK 2: Create production VPC manually OR

TASK 2: Create production VPC using Deployment Manager

gsutil cp -r gs://cloud-training/gsp321/dm .

cd dm

sed -i s/SET_REGION/us-east1/g prod-network.yaml

gcloud deployment-manager deployments create prod-network \ — config=prod-network.yaml

cd ..

TASK 3: Create bastion host

With the commands below, execute one at a time in the cloud shell.

gcloud compute instances create bastion — network-interface=network=griffin-dev-vpc,subnet=griffin-dev-mgmt — network-interface=network=griffin-prod-vpc,subnet=griffin-prod-mgmt — tags=ssh — zone=us-east1-b

gcloud compute firewall-rules create fw-ssh-dev — source-ranges= — target-tags ssh — allow=tcp:22 — network=griffin-dev-vpc

gcloud compute firewall-rules create fw-ssh-prod — source-ranges= — target-tags ssh — allow=tcp:22 — network=griffin-prod-vpc

TASK 4: Create and configure Cloud SQL Instance

gcloud sql instances create griffin-dev-db — root-password password — region=us-east1

gcloud sql connect griffin-dev-db

GRANT ALL PRIVILEGES ON wordpress.* TO “wp_user”@”%” IDENTIFIED BY “stormwind_rules”;

TASK 5: Create Kubernetes cluster

gcloud container clusters create griffin-dev \
— network griffin-dev-vpc \
— subnetwork griffin-dev-wp \
— machine-type n1-standard-4 \
— num-nodes 2 \
— zone us-east1-b

gcloud container clusters get-credentials griffin-dev — zone us-east1-b

cd ~/

TASK 6: Prepare the Kubernetes cluster

gsutil cp -r gs://cloud-training/gsp321/wp-k8s .

cd wp-k8s

sed -i s/username_goes_here/wp_user/g wp-env.yaml

sed -i s/password_goes_here/stormwind_rules/g wp-env.yaml

kubectl create -f wp-env.yaml

gcloud iam service-accounts keys create key.json — iam-account=cloud-sql-proxy@$

kubectl create secret generic cloudsql-instance-credentials — from-file key.json

I=$(gcloud sql instances describe griffin-dev-db — format=”value(connectionName)”)

sed -i s/YOUR_SQL_INSTANCE/$I/g wp-deployment.yaml

kubectl create -f wp-deployment.yaml

kubectl create -f wp-service.yaml

TASK 7 : Create a WordPress deployment
Step 1: Go to Navigation Menu, Scroll down and find Kubernetes Engine
Step 2: In Kubernetes Engine, Open Workloads. Then click on WordPress and under Exposing services open that endpoints to confirm WordPress is working. (Copy the IP address there. We’ll use it in Task 8)

TASK 8 : Enable monitoring
Step 1: Go to Navigation Menu, Scroll down and find Monitoring, then open that and click on uptime checks.
Step 2: In uptime checks, click CREATE UPTIME CHECK…
Step 3: use title as: wp check
Click next
In the hostname, paste your endpoints (the IP Address from Task 7, without the https://)
Click next
For Path, use /
Click next
Click next
Click Test (check if you receive 200 OK)
Finally, click Create

TASK 9: Provide access for an additional engineer
Step 1: Go to Navigation Menu, Find IAM & Admin
Step 2: In IAM, click ADD
New member as : Your Username 2 copy that and paste it there
In Role: Select Editor.
Click Save

You’ve successfully completed the third challenge lab.

Leave a Reply

Your email address will not be published. Required fields are marked *