add documentation for multi-project metrics#213
add documentation for multi-project metrics#213astropuffin wants to merge 1 commit intoGoogleCloudPlatform:masterfrom
Conversation
|
@kawych do you have any comments? |
| 1. Grant the default service account for your project access to `roles/monitoring.viewer` in | ||
| your other project. | ||
|
|
||
| 1. Create your GKE cluster with a service account, and grant the service account access to |
There was a problem hiding this comment.
| 1. Create your GKE cluster with a service account, and grant the service account access to | |
| 1. Create your GKE cluster with a custom service account, and grant the service account access to |
| `roles/monitoring.viewer` in your other project | ||
|
|
||
| 1. (Recommended) Create a service a service account for the stackdriver-adapter, and mount | ||
| the credentials into the pod. This is the method this example implements. |
There was a problem hiding this comment.
| the credentials into the pod. This is the method this example implements. | |
| the credentials into the pod. This is the method explained in this example. |
| ## Create a service account with credentials | ||
|
|
||
| For this example, you will need to create a service account. See [Creating a service account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) | ||
| for how to do that. |
There was a problem hiding this comment.
| for how to do that. | |
| for instructions. |
| for how to do that. | ||
|
|
||
|
|
||
| Next, you will need to create a key for that services account. See [Creating service account keys](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#iam-service-account-keys-create-console) for how to do that. |
There was a problem hiding this comment.
| Next, you will need to create a key for that services account. See [Creating service account keys](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#iam-service-account-keys-create-console) for how to do that. | |
| Next, you will need to create a key for that services account. See [Creating service account keys](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#iam-service-account-keys-create-console) for instructions. |
| Next, you will need to create a key for that services account. See [Creating service account keys](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#iam-service-account-keys-create-console) for how to do that. | ||
|
|
||
|
|
||
| Copy the key to this directory. The filename should be `key.json` |
There was a problem hiding this comment.
| Copy the key to this directory. The filename should be `key.json` | |
| Copy the key to your current directory. The filename should be `key.json` |
| Copy the key to this directory. The filename should be `key.json` | ||
|
|
||
|
|
||
| Add `roles/monitoring.viewer` to your service account in all projects that you want it to grab metrics from. |
There was a problem hiding this comment.
Maybe also add a link? https://cloud.google.com/iam/docs/granting-changing-revoking-access
| Run the following command: | ||
|
|
||
| ``` | ||
| kubectl apply -f modified-adapter.yml |
There was a problem hiding this comment.
Can you add a link using raw github content instead of assuming that user has cloned this repo? Something like: https://raw.githubusercontent.com/GoogleCloudPlatform/k8s-stackdriver/master/custom-metrics-stackdriver-adapter/examples/cross-project-metrics/adapter.yaml
| There are several places where cross project autoscaling can get stuck, so when troubleshooting | ||
| make sure to check them one by one. | ||
|
|
||
| 1. Check that your service account has the right permissions. It needs `roles/monitoring.viewer` |
There was a problem hiding this comment.
| 1. Check that your service account has the right permissions. It needs `roles/monitoring.viewer` | |
| 1. Check that your service account has the right permissions on the IAM page of **your other project**. It needs `roles/monitoring.viewer` |
| curl http://localhost:8001/apis/custom.metrics.k8s.io/v1beta1/namespaces/<namespace-name>/pods/*/<metric-name> | ||
| ``` | ||
|
|
||
| This should return a MetricValueList object. If you get a 404, the metric timeseries is not available from |
There was a problem hiding this comment.
There are two different cases here:
- You get 404 - this usually means that the metric descriptor for <metric-name> doesn't exist for specified project (e.g. or project is incorrect).
- You get [] (empty list) - this means that the metric is correct, but no timeseries were found. This may also be caused by several things, for example:
- <namespace-name> is incorrect
- <metric-name> wasn't exporter recently, e.g. deployment-to-be-scaled.yml was not deployed
Also, note that this url will look for metric for your current project. To check for metrics from different project, add suffix "?labelSelector=resource.labels.project_id=<my-other-project>"
| ``` | ||
| And check the available metrics | ||
| ``` | ||
| curl http://localhost:8001/apis/custom.metrics.k8s.io/v1beta1/ |
There was a problem hiding this comment.
Unfortunately this won't work. This returns metrics from your current project, while the requested metric can be specified only for the other project. It may still make sense to check that for predefined metrics (non-custom metrics) that should exist for all projects, such as pubsub metrics used here.
| @@ -0,0 +1,51 @@ | |||
| apiVersion: extensions/v1beta1 | |||
There was a problem hiding this comment.
It would be useful to include a comment at the top to explain that it is modified by mounting service account credentials.
kawych
left a comment
There was a problem hiding this comment.
Thanks for this! Added few commits, after these changes I think we're good to go
|
Sorry for delay with this review. FYI, I'm starting the release of this feature. |
|
Any updates on releasing this feature? |
|
I've started the release, but it got stuck in review, sorry for delay. |
documentation for #212
which addresses #205