Site icon Learning & Doing

Set Up and Configure a Cloud Environment in Google Cloud: Challenge Lab

Set Up

“Set Up and Configure a Cloud Environment in Google Cloud: Challenge Lab”

Solusi

Task 1: Create development VPC manually
Create a VPC called griffin-dev-vpc with the following subnets only:

griffin-dev-wp
IP address block: 192.168.16.0/20
griffin-dev-mgmt
IP address block: 192.168.32.0/20
Click Check my progress to verify the objective.
Create development VPC manually

gsutil cp -r gs://cloud-training/gsp321/dm .

cd dm
ls

nano prod-network.yaml

(here we have to change
region: us-east1)
^X and enter

gcloud deployment-manager deployments create griffin-prod --config prod-network.yaml

After this go to Navigation > Deployment Manger > Deployment 
click on griffin-prod … do nothing another checkpoint complete

Task3 Bastion host

Navigation > computer engine > VM instance

Click on create button after that 
Name : griffin-dev-db

scroll down to networking ..
Network tag = bastion

click on ‘add network interface’ button.

network = griffin-prod-vpc 
subnet same..
click on done

You will see two network interfaces

press create

now again navigate > VPC network > firewall
press create firewall rule

Name = allow-bastion-dev-ssh
Network = griffin-dev-vpc
Target Tag = bastion
source ip = 192.168.32.0/20
check on TCP and write 22

CREATE <- Click it 

At top click on create firewall rule for another rule

Name = allow-bastion-prod-ssh
Network = griffin-prod-vpc
Target Tag = bastion
source ip = 192.168.48.0/20
check on TCP and write 22

CREATE <- Click it

3rd checkpoint complete

task 4

Navigation > SQL >

create Instance

Choose my Sql

Instance ID = griffin-dev-db
Root Password = password
region – us-east1 (south..)
Zone – us-east1-b

press create
Finally created 🤩

press ‘connect using cloud shell’
then it will appear on shell

press enter and wait for 5 mintues..

enter password ..
this will appear
mysql>
copy this and paste the below command : ( or copy from the lab )

CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO "wp_user"@"%" IDENTIFIED BY "stormwind_rules";
FLUSH PRIVILEGES;

mysql>exit

4th checkpoint clear

Task 5 :

navigation > kubernetes engine > cluster
press create cluster

name = griffin-dev
location type = zone = us-east1-b 

on left hand panel click :

default-pool
Size = number of nodes =2

Nodes
series = N1
machince = n1 std 4 (4vCPU)

Networking
Network = griffin-dev-vpc
node subnet = griffin-dev-wp

press create 

5th checkpoint compete

Task 6

on shell write 

gsutil cp -r gs://cloud-training/gsp321/wp-k8s .
cd wp-k8s/
ls
nano wp-env.yaml

Now at the bottom change
username = wp_user
password = stormwind_rules
^X enter

now on kubernetes Engine > cluster
we have a row on griffin-dev press connet button RHS
then press ‘run on cloud shell’ 

after this write below command:
kubectl apply -f wp-env.yaml

then paste that
i.e “gcloud iam service-accounts keys create key.json \
–iam-account=cloud-sql-proxy@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com
kubectl create secret generic cloudsql-instance-credentials \
–from-file key.json”

checkpoint complete

Task 7

Navig > SQL >
press on griffin-dev-db 

In shell write:
ls
nano wp-deployment.yaml
scroll down to

instances = [] = tcp:3306″, where [] is connection name from SQL overview 

^x enter

in shell write :
kubectl create -f wp-deployment.yaml
kubectl create -f wp-service.yaml

now on navigation > kubernetes Engine > service and Ingress
click on wordpress
click on external endpoints 

it will redirect to wordpress account
{i.p}/wp-admin/install.php

7th checkpoint complete

Task 8th

Navigation > monitoring > overview

LHS click on uptime check

    create uptime check

title = WordPress Uptime
Protocol = HTTP
Host Name = {i.p address} 
Path = /

next

then test

again next

create

8th checkpoint compete

Task 9

Navi > IAM & Admin > IAM
press Add+
copy paste username
new member = username
Role = Base > Editor
Save
Exit mobile version