Skip to content

Commit

Permalink
Elaborate on GKE (googleapis#2366)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin authored Jun 8, 2017
1 parent e421cbe commit f4c4a79
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions packages/error-reporting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ runtime configuration object is set to `true`. See the [Configuration](#configu

In your project, on the command line:

```bash
```sh
# Install through npm while saving to the local 'package.json'
npm install --save @google-cloud/error-reporting
```
Expand Down Expand Up @@ -96,15 +96,26 @@ If you already have VMs that were created without API access and do not wish to

### Google Container Engine

Container Engine nodes need to also be created with the `https://www.googleapis.com/auth/cloud-platform` scope, which is configurable during cluster creation. Alternatively, you can follow the instructions for using a service account under [running elsewhere](#running-elsewhere). It's recommended that you store the service account credentials as [Kubernetes Secret](http://kubernetes.io/v1.1/docs/user-guide/secrets.html).
As with Compute Engine, Container Engine nodes need to be created with the `https://www.googleapis.com/auth/cloud-platform` scope, which is configurable during cluster creation:
* If the cluster is being created with the `gcloud` CLI, pass the scope to the command with the `--scopes` command (multiple scopes can be [delimited with a comma](https://cloud.google.com/sdk/gcloud/reference/container/clusters/create)):

```sh
gcloud container clusters create example-cluster-name --scopes https://www.googleapis.com/auth/cloud-platform
```

* If the cluster is being created through the Cloud Console UI, ensure that the "Cloud Platform" project access is set to "Enabled" (it's disabled by default).
Alternatively, you can also follow the instructions for using a service account under [running elsewhere](#running-elsewhere). It's recommended that you store the service account credentials as [Kubernetes Secret](http://kubernetes.io/v1.1/docs/user-guide/secrets.html).

## Running Elsewhere

If your application is running outside of Google Cloud Platform, such as locally, on-premise, or on another cloud provider, you can still use Stackdriver Errors.

1. You will need to specify your project ID when starting the errors agent.

GCLOUD_PROJECT=particular-future-12345 node myapp.js
```sh
GCLOUD_PROJECT=particular-future-12345 node myapp.js
```

1. You need to provide service account credentials to your application by using one of the three options below:
* The recommended way is via [Application Default Credentials][app-default-credentials].
Expand All @@ -114,16 +125,16 @@ If your application is running outside of Google Cloud Platform, such as locally
* If you are running your application on a development machine or test environment where you are using the [`gcloud` command line tools][gcloud-sdk], and are logged using `gcloud beta auth application-default login`, you already have sufficient credentials, and a service account key is not required.
* Alternatively, you may set the `keyFilename` or `credentials` configuration field to the full path or contents to the key file, respectively. Setting either of these fields will override either setting `GOOGLE_APPLICATION_CREDENTIALS` or logging in using `gcloud`. For example:

```js
// Require and start the agent with configuration options
var errors = require('@google-cloud/error-reporting')({
// The path to your key file:
keyFilename: '/path/to/keyfile.json',

// Or the contents of the key file:
credentials: require('./path/to/keyfile.json')
});
```
```js
// Require and start the agent with configuration options
var errors = require('@google-cloud/error-reporting')({
// The path to your key file:
keyFilename: '/path/to/keyfile.json',
// Or the contents of the key file:
credentials: require('./path/to/keyfile.json')
});
```

When running on Google Cloud Platform, we handle these for you automatically.

Expand Down

0 comments on commit f4c4a79

Please sign in to comment.