Manage Service Accounts
This page describes how Service Accounts are used for Clouds on GCP and how to manage Service Accounts.
Within a Cloud, Clusters run with a Service Account. Grant proper permissions to this Service Account for developers to access all required resources.
Default Service Account
A default Service Account is configured when you deploy a Cloud on GCP. All Anyscale Clusters within this Cloud run with this Service Account. This Service Account looks like the following:
<Anyscale Cloud ID with dashes, not underscores>@<project_id>.iam.gserviceaccount.com
e.g. cld-xyzabc@<project_id>.iam.gserviceaccount.com
- For GCE-based deployments, the project ID is the GCP project associated with your cloud.
- For legacy GKE deployments, the Service Account can be found in the
Provider Identity
column in clouds table on the configurations page.
Determine the Service Account on a running Cluster by running:
python -c "import google.auth.transport.requests; c,_=google.auth.default(); \
c.refresh(google.auth.transport.requests.Request()); print(c.service_account_email)"
Use an existing Service Account
This section walks through the steps to configure an existing Service Account for your Cloud and configure Clusters to use this Service Account. For help on how to create a Service Account, check out this guide.
Configure an existing Service Account (GCE)
To use a Service Account on Anyscale, grant Anyscale access to the Service Account and then grant the Service Account access to the GCS Bucket.
Access to the Service Account
No additional setup is required for Service Accounts in the same GCP Project as your Anyscale Cloud. If this does not work, ensure the Compute Engine Service Agent has the compute.serviceAgent
role on the specified Service Account.
Service Accounts in a separate GCP project require additional configuration:
Disable the
iam.disableCrossProjectServiceAccountUsage
Boolean constraint in the Service Account's project.Grant the Compute Engine Service Agent (format below) in the Anyscale Cloud's project the
compute.serviceAgent
role on the desired Service Account.
service-<Anyscale Cloud Project Number>@compute-system.iam.gserviceaccount.com
Grant the Anyscale access Service Account the
roles/iam.serviceAccountUser
role on the desired Service Account. This is necessary for the access Service Account to attach your Service Account to an instance.Ensure the Service Account that you are configuring has read, write and list access to the Google Storage bucket associated with your Anyscale cloud.
The GCP Project returned by Application Default Credentials is the Anyscale Cloud's Project, not the Service Account's Project.
Access to Cloud Storage
Anyscale Clusters require permission to read and write from their Anyscale Cloud's GCS Bucket. The easiest way to do this is to grant this Service Account the Storage Admin
role on the GCS Bucket associated with this Cloud.
Configure an existing Service Account (Legacy GKE)
This section walks through the steps to configure an existing Service Account for your Cloud.
Navigate to the GCP Service Account page and click
Select a Project
.Select the project that contains the Service Account. The Project ID is found in the Service Account email. The format for Service Account emails is:
service-account-name@project-id.iam.gserviceaccount.com
.Select the Service Account you want to use.
Go to the Permissions Tab on the top of the page.
- Click the "Grant Access" button.
- In the "New Principals" box, type your cloud-specific Service Account. This cloud specific-Service Account
should look like
<cloud_id>@<bridge_project_id>
and directions for finding it can be found here.
- In the "Role" box, search for “Service Account Token Creator” and select it.
- Click
Save
.
Configure Clusters to use this Service Account
With Service Account setup completed, configure Clusters to use it. In this step you will use the Service Account email from above.
- Create a new cluster compute (here). Select the cloud tied to the cloud-specific Service Account from Step 6 above.
Expand the "Advanced configuration" box.
In the "Advanced Configuration" field, paste the following JSON, replacing
SERVICE_ACCOUNT_EMAIL
with the actual email.
{
"serviceAccount": {"email": "SERVICE_ACCOUNT_EMAIL"}
}
Add a name for your cluster compute & press save. If you want to customize other parameters such as node configurations, do so at this time.
Ensure that you use this compute config when you launch Clusters.
noteEach Cluster runs with a single Service Account. The newly configured Service Account will be used instead of the default Service Account.