Solution To Create and Manage Cloud Resources: Challenge Lab

Solution To Create and Manage Cloud Resources: 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

1.Create a project Jumphost instance

The first step is to create a Jumphost instance

  • In the GCP Console go to Navigation Menu >Compute Engine > VM Instance.

Image description

  • Write the below parameters, check machine type, and Image type.
  • The name of instance be nucleus-jumphost
  • Region be Default Region
  • Zone be Default Zone
  • The machine type be f1-micro.
  • Using the default image type (Debian Linux)
  • Click Create

Image description

or use This command in shell to create the nucleus-jumphost

gcloud compute instances create nucleus-jumphost \
  --network nucleus-vpc \
  --zone us-east1-b  \
  --machine-type f1-micro  \
  --image-family debian-9  \
  --image-project debian-cloud      

2.Create a Kubernetes service cluster

In this step, you have to create a Kubernetes Service Cluster

  • Create the cluster in the us-east1-b region.
  • Using the Docker container hello-app ( as a place holder.
  • Open the app on port 8080
  • Activate Cloud Shell and write the following commands
gcloud container clusters create nucleus-backend \
          --num-nodes 1 \
          --network nucleus-vpc \
          --region us-east1

gcloud container clusters get-credentials nucleus-backend \
          --region us-east1

kubectl create deployment hello-server \

kubectl expose deployment hello-server \
          --type=LoadBalancer \
          --port 8080

It will create a Kubernetes cluster.

3.Setup an HTTP load balancer

In this step, you have to create a serve the site via Nginx web servers

  • Activate the cloud shell and Copy and Paste the following commands
cat << EOF >
#! /bin/bash
apt-get update
apt-get install -y nginx
service nginx start
sed -i — ‘s/nginx/Google Cloud Platform — ‘“\$HOSTNAME”’/’ /var/www/html/index.nginx-debian.html

Now you have to perform the steps to HTTP(s) Load Balancer in front of two web servers

-** Creating an instance template**:

gcloud compute instance-templates create web-server-template \
          --metadata-from-file \
          --network nucleus-vpc \
          --machine-type g1-small \
          --region us-east1

3. Creating a managed instance group:

gcloud compute instance-groups managed create web-server-group \
          --base-instance-name web-server \
          --size 2 \
          --template web-server-template \
          --region us-east1

4. Creating a firewall rule to allow traffic (80/tcp)

gcloud compute firewall-rules create web-server-firewall \
          --allow tcp:80 \
          --network nucleus-vpc

5. Creating a health check:

gcloud compute http-health-checks create http-basic-check
gcloud compute instance-groups managed \
          set-named-ports web-server-group \
          --named-ports http:80 \
          --region us-east1

6. Creating a backend service and attach the managed instance group:

gcloud compute backend-services create web-server-backend \
          --protocol HTTP \
          --http-health-checks http-basic-check \

gcloud compute backend-services add-backend web-server-backend \
          --instance-group web-server-group \
          --instance-group-region us-east1 \

7. Creating a URL map and target HTTP proxy to route requests to your URL map:

gcloud compute url-maps create web-server-map \
          --default-service web-server-backend

gcloud compute target-http-proxies create http-lb-proxy \
          --url-map web-server-map

8. Creating forwarding rule:

gcloud compute forwarding-rules create http-content-rule \
        --global \
        --target-http-proxy http-lb-proxy \
        --ports 80
gcloud compute forwarding-rules list

Congratulations! Done with the challenge lab.

Leave a Reply

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