Browse By

Set up and Configure a Cloud Environment in Google Cloud: Challenge Lab

In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the quest to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.

The challenge contains 9 required tasks:

  1. Create development VPC manually
  2. Create production VPC using Deployment Manager
  3. Create bastion host
  4. Create and configure Cloud SQL Instance
  5. Create Kubernetes cluster
  6. Prepare the Kubernetes cluster
  7. Create a WordPress deployment
  8. Enable monitoring
  9. Provide access for an additional engineer

Video Link

Task – 1 : Create development VPC manually

  1. gcloud compute networks create griffin-dev-vpc –subnet-mode custom
  1. gcloud compute networks subnets create griffin-dev-wp –network=griffin-dev-vpc –region us-east1 –range=192.168.16.0/20
  1. gcloud compute networks subnets create griffin-dev-mgmt –network=griffin-dev-vpc –region us-east1 –range=192.168.32.0/20

Task – 2 : Create production VPC manually

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

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

  1. gcloud deployment-manager deployments create prod-network \

             –config=prod-network.yaml

cd ..

Task – 3 : Create bastion host

  1. 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=0.0.0.0/0 –target-tags ssh –allow=tcp:22 –network=griffin-dev-vpc

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

Task – 4 : Create and configure Cloud SQL Instance

  1. gcloud sql instances create griffin-dev-db –root-password password –region=us-east1
  1. gcloud sql connect griffin-dev-db
  2. password
  1. CREATE DATABASE wordpress;

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

FLUSH PRIVILEGES;

  1. exit

Task – 5 : Create Kubernetes cluster

1. 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

 2. gcloud container clusters get-credentials griffin-dev –zone us-east1-b

  1. cd ~/
  2. gsutil cp -r gs://cloud-training/gsp321/wp-k8s .

Task – 6 : Prepare the Kubernetes cluste

  1. Open Editor -> wp-k8s -> wp-env.yaml Change username and password to:

username : wp_user , password : stormwind_rules -> SAVE

cd wp-k8s

kubectl create -f wp-env.yaml

gcloud iam service-accounts keys create key.json \

           –iam-account=cloud-sql-proxy@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com

  1. kubectl create secret generic cloudsql-instance-credentials \
  2. -from-file key.json

Task – 7 : Create a WordPress deployment

  • In editor: wp-deployment.yaml -> replace YOUR_SQL_INSTANCE with griffin-dev-db.
  • Save.

kubectl create -f wp-deployment.yaml

kubectl create -f wp-service.yaml

Task – 8 : Enable monitoring

  • Navigation Menu -> Kubernetes Engine -> Services and Ingress -> Copy Endpoint’s address.
  • Navigation Menu -> Monitoring -> Uptime Checks -> + CREATE UPTIME CHECK

 Title : WordPress Uptime

  • Next -> Target

Hostname : {Endpoint’s address} (without http…) 

Path : /

  • Next -> Next -> Create 

Task – 9 : Provide access for an additional engineer

  • Navigation Menu -> IAM & Admin -> IAM -> ADD

New Member : {Username 2 from Lab instruction page}

Role : Project -> Editor

Save.

Congratulations! You completed this challenge lab.

If you Want to Connect with Me:

Facebook: https://www.facebook.com/Info-Khajana-343418323414694

Read More

  1. Google Cloud Ready Facilitator Program 2021 in Hindi 
  2. Enrolment now in the GoogleCloudReady Facilitator Program in Hindi
  3. Rules for availing the prizes in Hindi

References

Program’s Syllabus