From bd5304a09743d3e998a0d7c3be1b030b1107ffa9 Mon Sep 17 00:00:00 2001 From: Alex Soul Date: Thu, 18 Feb 2021 17:29:02 +0000 Subject: [PATCH] Finished all labs --- Part_4.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Part_4.md b/Part_4.md index 94a0d28..ea80422 100644 --- a/Part_4.md +++ b/Part_4.md @@ -1246,6 +1246,50 @@ Cloud Profiler: Continuously analyzing CPU & Memory Performance, Supported servi #### Hands-On Lab: Discovering Latency with Google Cloud Trace +- Stand-up infrastructure +``` +gcloud services enable cloudtrace.googleapis.com +gcloud services enable container.googleapis.com +gcloud container clusters create cluster-1 --zone us-central1-c +gcloud container clusters get-credentials cluster-1 --zone us-central1-c # If created through the WebUI +kubectl get nodes +``` + +- Update `[PROJECT_ID]` in `./trace/acg-service-*.yaml*.template` within the cloned repo + +- Build Container Image, Tag and push to container registry +``` +docker build -t acg-image . +docker tag acg-image gcr.io/discovering--219-46060d10/acg-image +docker push gcr.io/discovering--219-46060d10/acg-image +``` +> I fucked the deployment by changing the tag in the deployment. The tag is referenced in the `deployment` spec under `./trace/app/acg-service-(a|b|c).yaml` + +[kubectl Cheatsheet](https://kubernetes.io/docs/reference/kubectl/cheatsheet/) + +You can force refresh containers after fixing (re-tag, re-push) the issue +``` +cloud_user_p_cff0f65a@cloudshell:~/content-gcpro-operations/trace (discovering--219-46060d10)$ kubectl rollout restart deployment/cloud-trace-acg-c +deployment.apps/cloud-trace-acg-c restarted +cloud_user_p_cff0f65a@cloudshell:~/content-gcpro-operations/trace (discovering--219-46060d10)$ kubectl get all +NAME READY STATUS RESTARTS AGE +pod/cloud-trace-acg-a-5f49648db7-ztjr5 1/1 Running 0 20s +pod/cloud-trace-acg-b-6966b8cb56-ztnvh 1/1 Running 0 4s +pod/cloud-trace-acg-b-bb7c98995-bfgld 0/1 Terminating 0 16m +pod/cloud-trace-acg-c-66497849b7-xlvjm 1/1 Running 0 16m +pod/cloud-trace-acg-c-6d5d5b489d-bwdbr 0/1 ContainerCreating 0 2s +``` + +- Run `setup.sh` script +``` +bash setup.sh +``` + +- Test the app +``` +curl $(kubectl get svc cloud-trace-acg-c -ojsonpath='{.status.loadBalancer.ingress[0].ip}') +``` + ### Identifying Application Errors with Debug/Error Reporting #### Section Introduction @@ -1360,6 +1404,18 @@ Error Reporting Notifications #### Hands-On Lab: Correcting Code with Cloud Debugger +``` +gcloud services list --available | grep -i debug +gcloud services enable clouddebugger.googleapis.com +git clone https://github.com/linuxacademy/content-gcpro-operations +cd content-gcpro-operations/debugger/ +gcloud app deploy # This failed first time, as GCP hadn't finished setting up services, just re-run and was successful +gcloud app browse # Opens link to the app +``` +- Update Code because `guru` fails to return properly reversed + +Fix code using debugger, set info point and use breakpoints + ### Course Conclusion #### Milestone: Are We There, Yet?