Skip to content

Commit c31c51d

Browse files
[DOC] Repository GCS ADC not supported (#33238)
Make it clear that automatic default credentials (ADC) is not supported for the repository-gcs plugin. "Service Account" method is the only alternative to authn requests to Google Cloud Storage.
1 parent 9c541b8 commit c31c51d

File tree

1 file changed

+70
-69
lines changed

1 file changed

+70
-69
lines changed

docs/plugins/repository-gcs.asciidoc

+70-69
Original file line numberDiff line numberDiff line change
@@ -10,71 +10,66 @@ include::install_remove.asciidoc[]
1010
[[repository-gcs-usage]]
1111
==== Getting started
1212

13-
The plugin uses the https://cloud.google.com/storage/docs/json_api/[Google Cloud Storage JSON API] (v1)
14-
to connect to the Storage service. If this is the first time you use Google Cloud Storage, you first
15-
need to connect to the https://console.cloud.google.com/[Google Cloud Platform Console] and create a new
16-
project. Once your project is created, you must enable the Cloud Storage Service for your project.
13+
The plugin uses the https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-clients/google-cloud-storage[Google Cloud Java Client for Storage]
14+
to connect to the Storage service. If you are using
15+
https://cloud.google.com/storage/[Google Cloud Storage] for the first time, you
16+
must connect to the https://console.cloud.google.com/[Google Cloud Platform Console]
17+
and create a new project. After your project is created, you must enable the
18+
Cloud Storage Service for your project.
1719

1820
[[repository-gcs-creating-bucket]]
1921
===== Creating a Bucket
2022

21-
Google Cloud Storage service uses the concept of https://cloud.google.com/storage/docs/key-terms[Bucket]
22-
as a container for all the data. Buckets are usually created using the
23-
https://console.cloud.google.com/[Google Cloud Platform Console]. The plugin will not automatically
24-
create buckets.
23+
The Google Cloud Storage service uses the concept of a
24+
https://cloud.google.com/storage/docs/key-terms[bucket] as a container for all
25+
the data. Buckets are usually created using the
26+
https://console.cloud.google.com/[Google Cloud Platform Console]. The plugin
27+
does not automatically create buckets.
2528

2629
To create a new bucket:
2730

28-
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console]
29-
2. Select your project
30-
3. Go to the https://console.cloud.google.com/storage/browser[Storage Browser]
31-
4. Click the "Create Bucket" button
32-
5. Enter the name of the new bucket
33-
6. Select a storage class
34-
7. Select a location
35-
8. Click the "Create" button
31+
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console].
32+
2. Select your project.
33+
3. Go to the https://console.cloud.google.com/storage/browser[Storage Browser].
34+
4. Click the *Create Bucket* button.
35+
5. Enter the name of the new bucket.
36+
6. Select a storage class.
37+
7. Select a location.
38+
8. Click the *Create* button.
3639

37-
The bucket should now be created.
40+
For more detailed instructions, see the
41+
https://cloud.google.com/storage/docs/quickstart-console#create_a_bucket[Google Cloud documentation].
3842

3943
[[repository-gcs-service-authentication]]
4044
===== Service Authentication
4145

42-
The plugin supports two authentication modes:
43-
44-
* The built-in <<repository-gcs-using-compute-engine, Compute Engine authentication>>. This mode is
45-
recommended if your Elasticsearch node is running on a Compute Engine virtual machine.
46-
47-
* Specifying <<repository-gcs-using-service-account, Service Account>> credentials.
48-
49-
[[repository-gcs-using-compute-engine]]
50-
===== Using Compute Engine
51-
When running on Compute Engine, the plugin use Google's built-in authentication mechanism to
52-
authenticate on the Storage service. Compute Engine virtual machines are usually associated to a
53-
default service account. This service account can be found in the VM instance details in the
54-
https://console.cloud.google.com/compute/[Compute Engine console].
55-
56-
This is the default authentication mode and requires no configuration.
57-
58-
NOTE: The Compute Engine VM must be allowed to use the Storage service. This can be done only at VM
59-
creation time, when "Storage" access can be configured to "Read/Write" permission. Check your
60-
instance details at the section "Cloud API access scopes".
46+
The plugin must authenticate the requests it makes to the Google Cloud Storage
47+
service. It is common for Google client libraries to employ a strategy named https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application[application default credentials].
48+
However, that strategy is **not** supported for use with Elasticsearch. The
49+
plugin operates under the Elasticsearch process, which runs with the security
50+
manager enabled. The security manager obstructs the "automatic" credential discovery.
51+
Therefore, you must configure <<repository-gcs-using-service-account,service account>>
52+
credentials even if you are using an environment that does not normally require
53+
this configuration (such as Compute Engine, Kubernetes Engine or App Engine).
6154

6255
[[repository-gcs-using-service-account]]
6356
===== Using a Service Account
64-
If your Elasticsearch node is not running on Compute Engine, or if you don't want to use Google's
65-
built-in authentication mechanism, you can authenticate on the Storage service using a
66-
https://cloud.google.com/iam/docs/overview#service_account[Service Account] file.
57+
You have to obtain and provide https://cloud.google.com/iam/docs/overview#service_account[service account credentials]
58+
manually.
59+
60+
For detailed information about generating JSON service account files, see the https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts[Google Cloud documentation].
61+
Note that the PKCS12 format is not supported by this plugin.
6762

68-
To create a service account file:
63+
Here is a summary of the steps:
6964

70-
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console]
71-
2. Select your project
72-
3. Got to the https://console.cloud.google.com/permissions[Permission] tab
73-
4. Select the https://console.cloud.google.com/permissions/serviceaccounts[Service Accounts] tab
74-
5. Click on "Create service account"
75-
6. Once created, select the new service account and download a JSON key file
65+
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console].
66+
2. Select your project.
67+
3. Got to the https://console.cloud.google.com/permissions[Permission] tab.
68+
4. Select the https://console.cloud.google.com/permissions/serviceaccounts[Service Accounts] tab.
69+
5. Click *Create service account*.
70+
6. After the account is created, select it and download a JSON key file.
7671

77-
A service account file looks like this:
72+
A JSON service account file looks like this:
7873

7974
[source,js]
8075
----
@@ -84,19 +79,26 @@ A service account file looks like this:
8479
"private_key_id": "...",
8580
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
8681
"client_email": "service-account-for-your-repository@your-project-id.iam.gserviceaccount.com",
87-
"client_id": "..."
82+
"client_id": "...",
83+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
84+
"token_uri": "https://accounts.google.com/o/oauth2/token",
85+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
86+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/[email protected]"
8887
}
8988
----
9089
// NOTCONSOLE
9190

92-
This file must be stored in the {ref}/secure-settings.html[elasticsearch keystore], under a setting name
93-
of the form `gcs.client.NAME.credentials_file`, where `NAME` is the name of the client configuration.
94-
The default client name is `default`, but a different client name can be specified in repository
95-
settings using `client`.
91+
To provide this file to the plugin, it must be stored in the {ref}/secure-settings.html[Elasticsearch keystore]. You must add a setting name of the form `gcs.client.NAME.credentials_file`, where `NAME`
92+
is the name of the client configuration for the repository. The implicit client
93+
name is `default`, but a different client name can be specified in the
94+
repository settings with the `client` key.
9695

97-
For example, if specifying the credentials file in the keystore under
98-
`gcs.client.my_alternate_client.credentials_file`, you can configure a repository to use these
99-
credentials like this:
96+
NOTE: Passing the file path via the GOOGLE_APPLICATION_CREDENTIALS environment
97+
variable is **not** supported.
98+
99+
For example, if you added a `gcs.client.my_alternate_client.credentials_file`
100+
setting in the keystore, you can configure a repository to use those credentials
101+
like this:
100102

101103
[source,js]
102104
----
@@ -113,19 +115,18 @@ PUT _snapshot/my_gcs_repository
113115
// TEST[skip:we don't have gcs setup while testing this]
114116

115117
The `credentials_file` settings are {ref}/secure-settings.html#reloadable-secure-settings[reloadable].
116-
After you reload the settings, the internal `gcs` clients, used to transfer the
117-
snapshot contents, will utilize the latest settings from the keystore.
118-
118+
After you reload the settings, the internal `gcs` clients, which are used to
119+
transfer the snapshot contents, utilize the latest settings from the keystore.
119120

120-
NOTE: In progress snapshot/restore jobs will not be preempted by a *reload*
121-
of the client's `credentials_file` settings. They will complete using the client
122-
as it was built when the operation started.
121+
NOTE: Snapshot or restore jobs that are in progress are not preempted by a *reload*
122+
of the client's `credentials_file` settings. They complete using the client as
123+
it was built when the operation started.
123124

124125
[[repository-gcs-client]]
125126
==== Client Settings
126127

127128
The client used to connect to Google Cloud Storage has a number of settings available.
128-
Client setting names are of the form `gcs.client.CLIENT_NAME.SETTING_NAME` and specified
129+
Client setting names are of the form `gcs.client.CLIENT_NAME.SETTING_NAME` and are specified
129130
inside `elasticsearch.yml`. The default client name looked up by a `gcs` repository is
130131
called `default`, but can be customized with the repository setting `client`.
131132

@@ -146,7 +147,7 @@ PUT _snapshot/my_gcs_repository
146147
// TEST[skip:we don't have gcs setup while testing this]
147148

148149
Some settings are sensitive and must be stored in the
149-
{ref}/secure-settings.html[elasticsearch keystore]. This is the case for the service account file:
150+
{ref}/secure-settings.html[Elasticsearch keystore]. This is the case for the service account file:
150151

151152
[source,sh]
152153
----
@@ -185,7 +186,7 @@ are marked as `Secure`.
185186

186187
`project_id`::
187188

188-
The Google Cloud project id. This will be automatically infered from the credentials file but
189+
The Google Cloud project id. This will be automatically inferred from the credentials file but
189190
can be specified explicitly. For example, it can be used to switch between projects when the
190191
same credentials are usable for both the production and the development projects.
191192

@@ -248,8 +249,8 @@ The following settings are supported:
248249

249250
The service account used to access the bucket must have the "Writer" access to the bucket:
250251

251-
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console]
252-
2. Select your project
253-
3. Got to the https://console.cloud.google.com/storage/browser[Storage Browser]
254-
4. Select the bucket and "Edit bucket permission"
255-
5. The service account must be configured as a "User" with "Writer" access
252+
1. Connect to the https://console.cloud.google.com/[Google Cloud Platform Console].
253+
2. Select your project.
254+
3. Got to the https://console.cloud.google.com/storage/browser[Storage Browser].
255+
4. Select the bucket and "Edit bucket permission".
256+
5. The service account must be configured as a "User" with "Writer" access.

0 commit comments

Comments
 (0)