To send metrics to the
application for your GCP account, you must set configuration properties in the
Do this configuration whether you are on a GKE or a non-GKE cluster.
To configure metrics collection:
- Create a GCP service account with the Monitoring Metrics Writer role. You can create
the service account using the
create-service-accountCLI, as the following example shows:
./tools/create-service-account my-metrics-svc-account apigee-metrics
For more information, see:
create-service-accountcommand saves a key on your system as a
.jsonfile. Note the path to the file. You will need the path in the following steps.
- Add the following configuration to your
... metrics: enabled: true serviceAccountPath: sa_json_file_path gcpProjectID: GCP_project_ID k8sClusterName: cluster_name gcpRegion: cluster_region
- sa_json_file_path is the path
on your filesystem to the service account JSON file the
- 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:
metrics: enabled: true serviceAccountPath: $HOME/hybrid/user-9c0dcb0c6c45.json gcpProjectID: myproject k8sClusterName: my-cluster gcpRegion: us-west2
- sa_json_file_path is the path on your filesystem to the service account JSON file the
- 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
- Save the
- Go to the next step, Grant cluster permissions.