Enable metrics

To send metrics to the Stackdriver application for your GCP account, you must set configuration properties in the overrides.yaml file. Do this configuration whether you are on a GKE or a non-GKE cluster.

To configure metrics collection:

  1. Create a GCP service account with the Monitoring Metrics Writer role. You can create the service account using the create-service-account CLI, as the following example shows:
    ./tools/create-service-account my-metrics-svc-account apigee-metrics

    For more information, see:

  2. The create-service-account command saves a key on your system as a .json file. Note the path to the file. You will need the path in the following steps.
  3. Add the following configuration to your overrides.yaml file:
    ...
    metrics:
      enabled: true
      serviceAccountPath: sa_json_file_path
    gcpProjectID: GCP_project_ID
    k8sClusterName: cluster_name
    gcpRegion: cluster_region

    Where:

    • sa_json_file_path is the path on your filesystem to the service account JSON file the create-service-account command saved.
    • GCP_project_ID is your GCP project ID for the project where you want the metrics to be sent to.
    • cluster_name is the name of the cluster running hybrid.
    • cluster_region is a GCP region name. See the note below for more information:

    For example:

    metrics:
      enabled: true
      serviceAccountPath: $HOME/hybrid/user-9c0dcb0c6c45.json
    gcpProjectID: myproject
    k8sClusterName: my-cluster
    gcpRegion: us-west2
  4. GKE only: If you are on GKE, in addition to the mandatory overrides, you need to grant your own user the GKE cluster admin role:
    ACCOUNT=$(gcloud info --format='value(config.account)')
    kubectl create clusterrolebinding owner-cluster-admin-binding \
    --clusterrole=cluster-admin --user=$ACCOUNT
  5. Save the overrides.yaml file.
  6. Go to the next step, Grant cluster permissions.

Next Step

1 2 3 4 5 6 7 8 NEXT: 9: PERMISSIONS 10 11