GSP-314 : Deploy and Manage Cloud Environments with Google Cloud
Overview
Task 1 : Create Production Environment
- SSH to
kraken-jumphost
and run
1cd /work/dm
2sed -i s/SET_REGION/us-east1/g prod-network.yaml
3
4gcloud deployment-manager deployments create prod-network --config=prod-network.yaml
5
6gcloud config set compute/zone us-east1-b
7
8gcloud container clusters create kraken-prod \
9 --num-nodes 2 \
10 --network kraken-prod-vpc \
11 --subnetwork kraken-prod-subnet\
12 --zone us-east1-b
13
14gcloud container clusters get-credentials kraken-prod
15
16cd /work/k8s
17
18for F in $(ls *.yaml); do kubectl create -f $F; done
Task 2 : Setup the Admin instance
- Still in kraken-jumphost's SSH, run
1gcloud config set compute/zone us-east1-b
2
3gcloud compute instances create kraken-admin --network-interface="subnet=kraken-mgmt-subnet" --network-interface="subnet=kraken-prod-subnet"
Create alert
- Open monitoring
- Create an alert
- Configure the policy to email your email and set
1 Resource Type : VM Instance
2 Metric : CPU utilization
3 Filter : instance_name
4 Value : kraken-admin
5 Condition : is above
6 Threshold : 50%
7 For : 1 minute
Task 3 : Verify the Spinnaker deployment
- Switch to cloudshell, run
1gcloud config set compute/zone us-east1-b
2
3gcloud container clusters get-credentials spinnaker-tutorial
4
5DECK_POD=$(kubectl get pods --namespace default -l "cluster=spin-deck" -o jsonpath="{.items[0].metadata.name}")
6
7kubectl port-forward --namespace default $DECK_POD 8080:9000 >> /dev/null &
-
Go to cloudshell webpreview
-
Go to applications -> sample
-
Open pipelines and manually run the pipeline if it has not already running.
-
Approve the deployment to production.
-
Check the production frontend endpoint (use http, not the default https)
-
Back to cloudshell, run to push a change
1gcloud config set compute/zone us-east1-b
2
3gcloud source repos clone sample-app
4
5cd sample-app
6touch a
7
8git config --global user.email "$(gcloud config get-value account)"
9git config --global user.name "Student"
10git commit -a -m "change"
11git tag v1.0.1
12git push --tags
Congratulations, you're all done with the lab 😄