-
Notifications
You must be signed in to change notification settings - Fork 2
/
lab challange.txt
178 lines (118 loc) · 4.53 KB
/
lab challange.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
Stepno1
gcloud config set compute/zone us-east1-b
gcloud container clusters create nucleus-webserver1
Stepn02
gcloud container clusters get-credentials nucleus-webserver1
Kubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:2.0
Go through kubernetes Engine then clusters
Kubectl expose deployment hello-app --type=LoadBalancer --port 8080
Kubectl get service
Kubect1 get service
Kubect1 get service
Kubect1 get service
TASK03
Copy from task
gcloud compute instance-templates create nginx-template \
> --metadata-from-file startup-script=startup.sh
gcloud compute target-pools create nginx-pool
Enter n
Select 18
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
gcloud compute firewall-rules create wwwfirewall --allow tcp:80
gcloud compute forwarding-rules create nginx-1b \
--region us-east1 \
--ports=80 \
--target-pool nginx-pool
gcloud compute forwarding-rules list
gcloud compute http-health-checks create http-basic-check > //go through health check option//
gcloud compute instance-groups managed \
--set-named-ports nginx-group \
--named-ports http:80
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
//check instances //
gcloud compute url-maps create web-map \
--default-service nginx-backend
gcloud compute target-http-proxies create http-lb-proxy \
--url-map web-map
gcloud computing forwarding-rules create http-content-rule \
--global \
--target-http-proxy http-lb-proxy \
--ports 80
gcloud compute forwarding-rules
create http-content-rule \
LAB MATERIAL
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
//Creating the backend Kubernetes cluster
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
--region us-east1
kubectl expose deployment hello-server \
--type=LoadBalancer \
--port 8080
//Creating the web server frontend
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
EOF
gcloud compute instance-templates create web-server-template \
--metadata-from-file \
--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 //check health
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 \ //check insatance
--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 \ //check instance
--ports 80
gcloud compute forwarding-rules list
Hope this helps!
Type a message here...
Type a message here...