Monday, March 4, 2024
Cloud Trace GCP GKE Juara GCP Kubernetes

Using Cloud Trace on Kubernetes Engine

trace

“Using Cloud Trace on Kubernetes Engine”

Pengantar

Saat mendukung sistem produksi yang melayani permintaan HTTP atau menyediakan API, penting untuk mengukur latensi titik akhir Anda untuk mendeteksi ketika kinerja sistem tidak beroperasi sesuai spesifikasi. Dalam sistem monolitik, ukuran latensi tunggal ini mungkin berguna untuk mendeteksi dan mendiagnosis perilaku yang memburuk. Namun, dengan arsitektur layanan mikro modern, ini menjadi jauh lebih sulit karena satu permintaan dapat menghasilkan banyak permintaan tambahan ke sistem lain sebelum permintaan tersebut dapat ditangani sepenuhnya.

Architecture

Praktikum

Task 1. Initialization

Clone demo

git clone https://github.com/GoogleCloudPlatform/gke-tracing-demo
cd gke-tracing-demo
gcloud config set compute/region us-central1
gcloud config set compute/zone us-central1-a
cd terraform

Update the provider.tf file

  • Edit the provider.tf script file:
nano provider.tf
....
provider "google" {
  project = var.project
  version = "~> 2.10.0"
}
terraform init
../scripts/generate-tfvars.sh
gcloud config list

Task 2. Deployment

terraform plan
terraform apply

Create a Monitoring Metrics Scope

  • click Navigation menu Navigation menu icon > Monitoring.

Task 3. Deploy demo application

  • Back in Cloud Shell, after you see the Apply complete! message, return to the Console.
  • In the Navigation menu, go to Kubernetes Engine > Clusters to see your cluster.
  • Click on Navigation menu, then scroll down to the Analytics section and click on Pub/Sub to see the Topic and Subscription.
  • Now, deploy the demo application using Kubernetes’s kubectl command:
kubectl apply -f tracing-demo-deployment.yaml

Once the app has been deployed, it can be viewed in the Kubernetes Engine > Workloads. You can also see the load balancer that was created for the application in the Services & Ingress section of the console.

echo http://$(kubectl get svc tracing-demo -n default -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

Task 4. Validation

  • Still in the Kubernetes window, click Services & Ingress to view the exposed services.

Pulling Pub/Sub messages

gcloud pubsub subscriptions pull --auto-ack --limit 10 tracing-demo-cli

Monitoring and logging

  • In the Console, select Navigation menu > Monitoring > Metrics Explorer.
  • In the Select a metric field, select VM Instance > Instance > CPU Usage then click Apply.
  • To see logs, select Navigation menu > Logging.
  • In Log fields section, set the following:
RESOURCE TYPE: Kubernetes Container
CLUSTER NAME: tracing-demo-space
NAMESPACE NAME: default

Task 5. Troubleshooting in your own environment

kubectl get deployment tracing-demo
kubectl describe deployment tracing-demo
kubectl get pod
kubectl describe pod tracing-demo

Task 6. Teardown

terraform destroy

Penutup

Sahabat Blog Learning & Doing demikianlah penjelasan mengenai Using Cloud Trace on Kubernetes Engine. Semoga Bermanfaat . Sampai ketemu lagi di postingan berikut nya.

(Visited 41 times, 1 visits today)

Similar Posts