Create and Manage Cloud Resources: Challenge Lab

0
 In this article we will see how can we solve the lab Create and Manage Cloud Resources: Challenge Lab . if you loo at the right side bar you will see some tasks mentioned . We have to complete those tasks one by one . Once the task is completed then we will earn a badge .

As you can see there are three tasks mentioned in the side bar.

Task 1 : Create a project jumphost instance

Task 2 : Create a kubernetes Service Cluster

Task 3 : Set up an http load balancer



Task 1. Create a project jumphost instance Solution



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 \
--scopes cloud-platform \
--no-address


Task 2. Create a Kubernetes service cluster Solution


The second problem we have is to create a Kubernetes Service Cluster. To solve this problem again open the Cloud Terminal . Once the terminal is opened copy and paste this command .



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 \
--image=gcr.io/google-samples/hello-app:2.0



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






Task 3. Set up an HTTP load balancer Solution


The third problem we have is to setup an http load balancer . To solve this problem again open the Cloud Terminal . Once the terminal is opened copy and paste these commands .



cat << EOF > startup.sh
#! /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
EOF



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



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



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



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



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



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



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



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



gcloud compute forwarding-rules list




That's It. In this way you can solve this challenge lab. Once you are done will all the other challenge in this section,  you will receive a badge for the same.



Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !