-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCode.txt
134 lines (89 loc) · 3.45 KB
/
Code.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
123
124
125
126
127
128
129
130
131
132
133
134
-------- Getting-Started-Create-and-Manage-Cloud-Resources-Challenge-Lab ------
Task1
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
******************************************************************
Task2
PART A
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
******************************************************************
PART B
kubectl create deployment hello-server \
--image=gcr.io/google-samples/hello-app:2.0
******************************************************************
PART C
kubectl expose deployment hello-server \
--type=LoadBalancer \
--port 8080
******************************************************************
Task3
PART A
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
******************************************************************
PART B
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
******************************************************************
PART C
gcloud compute instance-groups managed create web-server-group \
--base-instance-name web-server \
--size 2 \
--template web-server-template \
--region us-east1
******************************************************************
PART D
gcloud compute firewall-rules create web-server-firewall \
--allow tcp:80 \
--network nucleus-vpc
******************************************************************
PART E
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
******************************************************************
PART F
gcloud compute backend-services create web-server-backend \
--protocol HTTP \
--http-health-checks http-basic-check \
--global
******************************************************************
PART G
gcloud compute backend-services add-backend web-server-backend \
--instance-group web-server-group \
--instance-group-region us-east1 \
--global
******************************************************************
PART H
gcloud compute url-maps create web-server-map \
--default-service web-server-backend
******************************************************************
PART I
gcloud compute target-http-proxies create http-lb-proxy \
--url-map web-server-map
******************************************************************
PART J
gcloud compute forwarding-rules create http-content-rule \
--global \
--target-http-proxy http-lb-proxy \
--ports 80
gcloud compute forwarding-rules list