Skip to main content

GKE cluster access

Before you create a GKE compute environment, prepare the cluster and give the Google service account in your GKE credentials access to it. To use Fusion, also give the Kubernetes service accounts access to the work directory bucket.

Prerequisites

You need the following:

  • A running GKE cluster.

To create the resources that Seqera requires, follow the cluster preparation instructions. In addition to the generic Kubernetes instructions, make the following modifications specific to GKE.

Service account role​

Grant cluster access to the service account that the Seqera compute environment uses. To do this, update the service account RoleBinding:

cat << EOF | kubectl apply -f -
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: tower-launcher-userbind
subjects:
- kind: User
name: <IAM SERVICE ACCOUNT>
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: tower-launcher-role
apiGroup: rbac.authorization.k8s.io
---
EOF

Replace <IAM SERVICE ACCOUNT> with the corresponding service account, for example, test-account@test-project-123456.google.com.iam.gserviceaccount.com.

See Role-based access control.

Fusion v2​

To use Fusion v2 in your Seqera GKE compute environment:

  1. Use Seqera Platform version 23.1 or later.
  2. Use a Cloud Storage bucket as the work directory.
  3. Give both the head service account and the compute service account access to the Cloud Storage bucket specified as the work directory.
Configure IAM to use Fusion v2
  1. Ensure the Workload Identity feature is enabled for the cluster:

    • Enable Workload Identity in the cluster Security settings.
    • Enable GKE Metadata Server in the node group Security settings.
  2. Give the IAM service account access to the Cloud Storage buckets your pipeline uses. Run the following command for each bucket and role:

    gcloud storage buckets add-iam-policy-binding gs://<YOUR-BUCKET> --role <ROLE> --member serviceAccount:<IAM-SERVICE-ACCOUNT>@<GOOGLE-CLOUD-PROJECT>.iam.gserviceaccount.com

    Grant the following roles:

    • Work directory bucket: Storage Object User (roles/storage.objectUser) and Storage Bucket Viewer (roles/storage.bucketViewer)
    • Input data buckets: Storage Object Viewer (roles/storage.objectViewer) and Storage Bucket Viewer (roles/storage.bucketViewer)
    • Publish directory bucket, if different from the work directory: Storage Object User (roles/storage.objectUser)

    Fusion reads bucket metadata (storage.buckets.get) for each bucket it accesses. Storage Object User and Storage Object Viewer don't include this permission. Because Nextflow copies results to the publish directory from the head pod, not through Fusion, the publish directory bucket doesn't need it. If a bucket is missing storage.buckets.get, Fusion reports the bucket as not found instead of returning a permission error. Storage Bucket Viewer is a Beta role in Google Cloud. To avoid Beta roles, create a custom role with the storage.buckets.get and storage.buckets.list permissions.

  3. Allow the Kubernetes service account to impersonate the IAM service account:

    gcloud iam service-accounts add-iam-policy-binding <IAM-SERVICE-ACCOUNT>@<GOOGLE-CLOUD-PROJECT>.iam.gserviceaccount.com --role roles/iam.workloadIdentityUser --member "serviceAccount:<GOOGLE-CLOUD-PROJECT>.svc.id.goog[<GKE-NAMESPACE>/<GKE-SERVICE-ACCOUNT>]"
  4. Annotate the Kubernetes service account with the email address of the IAM service account:

    kubectl annotate serviceaccount <GKE-SERVICE-ACCOUNT> --namespace <GKE-NAMESPACE> iam.gke.io/gcp-service-account=<IAM-SERVICE-ACCOUNT>@<GOOGLE-CLOUD-PROJECT>.iam.gserviceaccount.com

See the GKE documentation.

Next step​

Create a GKE compute environment.