|
| 1 | +# cloud-trace-demo-app-opentelemetry |
| 2 | + |
| 3 | +Open this demo app in [Google Cloud Shell](https://cloud.google.com/shell/docs/). This includes necessary tools. |
| 4 | + |
| 5 | + |
| 6 | +[](https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=trace/cloud-trace-demo-app/README.md&cloudshell_tutorial=trace/cloud-trace-demo-app/README.md) |
| 7 | + |
| 8 | +#### Demo Requirements |
| 9 | +If you are using Cloud Shell, skip to the next section. |
| 10 | + |
| 11 | +1. Install gcloud <https://cloud.google.com/sdk/install> |
| 12 | +2. Install kubectl <https://kubernetes.io/docs/tasks/tools/install-kubectl/> |
| 13 | +3. Install docker <https://docs.docker.com/install/> |
| 14 | + |
| 15 | + |
| 16 | +#### Create a GKE cluster |
| 17 | + |
| 18 | +4. Enable Google Cloud and set up region and zone. |
| 19 | + |
| 20 | + `gcloud init` |
| 21 | +5. Enable the GKE API & billing: |
| 22 | + |
| 23 | + `gcloud services enable container.googleapis.com` |
| 24 | +6. Create a GKE cluster named "cloud-trace-demo", replacing `your-gcp-zone` below |
| 25 | +with the |
| 26 | +[GCP Zone](https://cloud.google.com/compute/docs/regions-zones) closest in proximity to you: |
| 27 | + |
| 28 | + ``` |
| 29 | + gcloud container clusters create cloud-trace-demo\` |
| 30 | + --num-nodes 1 \ |
| 31 | + --enable-basic-auth \ |
| 32 | + --issue-client-certificate \ |
| 33 | + --zone your-gcp-zone |
| 34 | + ``` |
| 35 | +7. Verify that you have access to the cluster: |
| 36 | + |
| 37 | + `kubectl get nodes` |
| 38 | + |
| 39 | +#### Deploy The Cloud Trace Demo App |
| 40 | + |
| 41 | +8. Build and tag the docker image for demo app: |
| 42 | + |
| 43 | + `docker build -t gcr.io/${PROJECT_ID}/cloud-trace-demo:v1 .` |
| 44 | +9. Deploy resource to the cluster: |
| 45 | + |
| 46 | + `kubectl apply -f deployment.yaml` |
| 47 | +10. Track the status of the deployment: |
| 48 | + |
| 49 | + `kubectl get deployments` |
| 50 | + |
| 51 | + Deployment is complete when all of the available deployments are ready. |
| 52 | +11. Run the following command to see the pods the deployment created: |
| 53 | + |
| 54 | + `kubectl get pods` |
| 55 | + |
| 56 | +#### Deploy The Cloud Trace Demo Service |
| 57 | + |
| 58 | +12. Create the cloud trace demo service: |
| 59 | + |
| 60 | + `kubectl apply -f service.yaml` |
| 61 | +13. Get the services IP address by running the following command: |
| 62 | + |
| 63 | + `kubectl get services` |
| 64 | +14. Send a curl request to the EXTERNAL_IP, replacing `EXTERNAL_IP` with the external IP address found |
| 65 | +in step 13: |
| 66 | + |
| 67 | + `curl EXTERNAL_IP` |
| 68 | +15. Visit [Trace List](https://console.cloud.google.com/traces/list) to check traces generated. |
| 69 | + Click on any trace in the graph to see the Waterfall View. |
| 70 | + |
| 71 | +  |
| 72 | +16. Clean up GKE cluster/pods/services: |
| 73 | + |
| 74 | + `gcloud container clusters delete cloud-trace-demo` |
0 commit comments