Set Up and Configure a Cloud Environment in Google Cloud: Challenge Lab
Task1: Create development VPC manually
search:vpc network and click on create
name: griffin-dev-vpc
subnet = custom
name:griffin-dev-wp
region:us east1
IP range: 192.168.16.0/20
click on Done
click on add subnet
name:griffin-dev-mgmt
Ip range:192.168.32.0/20
region:us east1
Done
click on create
Task 2: Create production VPC manually
search:vpc network and click on create
name:griffin-prod-vpc
subnet:custon
name:griffin-prod-wp
IP:192.168.48.0/20
region us east1
Done
click on add subnet
name: griffin-prod-mgmt
IP:192.168.64.0/20
Us east1
Task 3: Create bastion host
search :compute engine
click on create instance
name:bastion-host
us east1 us eastb by default
series N1 and machine n1-standard-1
management security network
click networking and networking interface pencil icon
network: griffin-dev-vpc
subnet:griffin-dev-mgmt
primary internal : Epherneal(Automatic)
Done
again click on add
select another one auto selected
Done
click on create
search: vpc network
click on firewall
create firewall
name: griffin-dev-vpc-firewall
network:griffin-dev-vpc
target tag:griffin-dev-vpc
IP:0.0.0.0/0
tcp:22
click on create
again click on create firewall
name:griffin-prod-vpc-firewall
network:griffin-prod-vpc
targettag:griffin-prod-vpc
IP:0.0.0.0/0
tcp:22
click on create
Task 4: Create and configure Cloud SQL Instance
serach:sql
click create instance
choose my squl
name:griffin-dev-db
password:pas
reason: us east1
click on create instance
wait 10 min once created copy connection name and save it for later use(qwiklabs-
gcp-04-4a5d31fcb2d8:us-east1:griffin-dev-db
gcloud sql connect griffin-dev-db --user=root
give password: pas and press enter
run this code:
CREATE DATABASE wordpress;
CREATE USER "wp_user"@"%" IDENTIFIED BY "stormwind_rules";
GRANT ALL PRIVILEGES ON wordpress.* TO "wp_user"@"%";
FLUSH PRIVILEGES;
type: exit
Task 5: Create Kubernetes cluster
gcloud container clusters create griffin-dev \
--network griffin-dev-vpc \
--subnetwork griffin-dev-wp \
--machine-type n1-standard-4 \
--num-nodes 2 \
--zone us-east1-b
Task 6: Prepare the Kubernetes cluster
gsutil cp -r gs://cloud-training/gsp321/wp-k8s .
cd wp-k8s
sed -i s/username_goes_here/wp_user/g wp-env.yaml
sed -i s/password_goes_here/stormwind_rules/g wp-env.yaml
search kubernetes engine
click on grifine-dev
click on connect
click on run in cloud shell
and press enter
kubectl apply -f wp-env.yaml
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
Task 7: Create a WordPress deployment
nano wp-deployment.yaml
search sql
click on
scroll down and copy connection name
use down arrow and find Your_SQL_Instance-tcp...
repalce Your_SQL_instance =connection name you copied
ctril+o enter
ctril +x
kubectl create -f wp-deployment.yaml
kubectl create -f wp-service.yaml
Task 8: Enable monitoring
search: kubermetes engine
clcik on services and ingress
open and scroll down to external endpoint and open link to get IP : like
35.195.110.86
search: monitoring
click on uptime checks
create uptime check
name: wordpress-uptime
hostname: iP address remove http and aother slash
path: /
next
click on Test
next
create
Task 9: Provide access for an additional engineer
I am I am
copy secondusername
click on add
paste name
select role
basic editor
Congrat !