-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGSP313-Create and Manage Cloud Resources: Challenge Lab.txt
122 lines (81 loc) · 3.3 KB
/
GSP313-Create and Manage Cloud Resources: Challenge Lab.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Create and Manage Cloud Resources: Challenge Lab
For any assist & query Connect me :
Linkedin : https://www.linkedin.com/in/sahoo-ashutosh/
Discord : AshuKulu#6975
Challenge Scenario:-
You have 3 taks to Complete
Task 1: Create a project jumphost instance
Go to: Navigation menu > Compute engine > VM Instance
Write the below parameters, check machine type, and Image type.
The name of instance must be "nucleus-jumphost-<Your Custum Name from Qwiklab Page>"
Region be Default Region
Zone be Default Zone
The machine type be: 'f1-micro'
Using the default image type (Debian Linux)
Click Create
Task 2: Create a Kubernetes service cluster
Create the cluster in the us-east1 region.
Using the Docker container hello-app `gcr.io/google-samples/hello-app:2.0`
Open the app on port 8080
Run the following in Cloud Shell
gcloud config set compute/zone us-east1-b
gcloud container clusters create nucleus-webserver1
gcloud container clusters get-credentials nucleus-webserver1
kubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:2.0
kubectl expose deployment hello-app --type=LoadBalancer --port <Your Custom port from Qwiklab page>
kubectl get service
Task 3: Setup an HTTP load balancer
Run the following in Cloud Shell
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
1 .Create an instance template :
gcloud compute instance-templates create nginx-template \
--metadata-from-file startup-script=startup.sh
2 .Create a target pool :
gcloud compute target-pools create nginx-pool
if prompts for region [asia-southeast1] for target pool: [Y/n] choose 'n'
then choose '23' for us-east1 i.e. our default zone
3 .Create a managed instance group :
gcloud compute instance-groups managed create nginx-group \
--base-instance-name nginx \
--size 2 \
--template nginx-template \
--target-pool nginx-pool
gcloud compute instances list
4 .Create a firewall rule to allow traffic (80/tcp) :
gcloud compute firewall-rules create <Your Custom Firewall rule from Qwiklab page> --allow tcp:80
gcloud compute forwarding-rules create nginx-lb \
--region us-east1 \
--ports=80 \
--target-pool nginx-pool
gcloud compute forwarding-rules list
5 .Create a health check :
gcloud compute http-health-checks create http-basic-check
gcloud compute instance-groups managed \
set-named-ports nginx-group \
--named-ports http:80
6 .Create a backend service and attach the manged instance group :
gcloud compute backend-services create nginx-backend \
--protocol HTTP --http-health-checks http-basic-check --global
gcloud compute backend-services add-backend nginx-backend \
--instance-group nginx-group \
--instance-group-zone us-east1-b \
--global
7 .Create a URL map and target HTTP proxy to route requests to your URL map :
gcloud compute url-maps create web-map \
--default-service nginx-backend
gcloud compute target-http-proxies create http-lb-proxy \
--url-map web-map
8 .Create a forwarding rule :
gcloud compute forwarding-rules create http-content-rule \
--global \
--target-http-proxy http-lb-proxy \
--ports 80
gcloud compute forwarding-rules list
Wait for 5 minutes if your progress is not checked
Congratulations! Done with the challenge lab.