[GSP497] Monitoring with Stackdriver on Kubernetes Engine
Делаю:
04.05.2019
https://www.qwiklabs.com/focuses/5157?parent=catalog
Overview
Stackdriver Kubernetes Monitoring is a new Stackdriver feature that more tightly integrates with GKE to better show you key stats about your cluster and the workloads and services running in it. Included in the new feature is functionality to import, as native Stackdriver metrics, metrics from pods with Prometheus endpoints. This allows you to use Stackdriver native alerting functionality with your Prometheus metrics without any additional workload.
Architecture
This lab will create a Kubernetes Engine cluster that has a sample application deployed to it. The logging and metrics for the cluster are loaded into Stackdriver Logging by default. In the tutorial a Stackdriver Monitoring account will be setup to view the metrics captured.
Install Terraform
$ gcloud config set compute/region us-central1
$ gcloud config set compute/zone us-central1-a
$ git clone https://github.com/GoogleCloudPlatform/gke-monitoring-tutorial.git
$ cd gke-monitoring-tutorial
Configure Authentication
$ gcloud auth application-default login
Copy the URL that is returned in the output, then paste it into a new browser window.
Select the login credentials for this lab, and click Allow.
Copy the code provided and paste it into the Cloud Shell prompt.
Create Stackdriver workspace
GCP –> Monitoring
Нужно дождаться когда прогрузится, прежде чем переходить на следующий шаг. Первый раз не дождался. Была ошибка. (Впрочем может быть не из-за этого)
Deploying the cluster
$ make create
This will:
- Read your project & zone configuration to generate a couple config files: ./terraform/terraform.tfvars for Terraform variables ./manifests/prometheus-service-sed.yaml for the Prometeus policy to be created in Stackdriver
- Run terraform init to prepare Terraform to create the infrastructure
- Run terraform apply to actually create the infrastructure & Stackdriver alert policy
If you need to override any of the defaults in the Terraform variables file, simply replace the desired value(s) to the right of the equals sign(s). Be sure your replacement values are still double-quoted.
If no errors are displayed then after a few minutes you should see your Kubernetes Engine cluster in the GCP Console.
$ make validate
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
prometheus-8466bbdffc-9jnfc 1/1 Running 0 5m10s
Teardown
$ make teardown