This document explains how to establish an SSH connection to your cluster's
nodes in Cluster Director. Based on your cluster's orchestrator, connecting to a
node lets you perform the following tasks:

- **Slurm clusters**: manage shared file systems, submit Slurm jobs to the
  cluster scheduler, inspect logs, or manually run a health check on a GPU.

- **Managed compute clusters**: connect to compute instances to configure your
  environment and launch distributed workloads.

For more information on how Compute Engine uses key-based SSH authentication
to establish connections to a Compute Engine instance, see
[About SSH connections](https://docs.cloud.google.com/compute/docs/instances/ssh.md.txt).

## Before you begin

Before you connect to a login or compute node in a cluster, consider the
following:

-


  When you use the Google Cloud console to access Google Cloud services and
  APIs, you don't need to set up authentication.

  <br />

- If you encounter errors when connecting to your node, then see
  [Troubleshooting SSH errors](https://docs.cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh-errors.md.txt).

### Required roles


To get the permissions that
you need to connect to a login or compute node in a cluster,

ask your administrator to grant you the
following IAM roles:

- To view clusters: [Cluster Director Editor](https://docs.cloud.google.com/iam/docs/roles-permissions/hypercomputecluster.md.txt#hypercomputecluster.editor) (`roles/hypercomputecluster.editor`) on your project
- To connect to a node:
  - [Compute OS Login](https://docs.cloud.google.com/iam/docs/roles-permissions/compute.md.txt#compute.osLogin) (`roles/compute.osLogin`) on your project
  - [Service Account User](https://docs.cloud.google.com/iam/docs/roles-permissions/iam.md.txt#iam.serviceAccountUser) (`roles/iam.serviceAccountUser`) on the [Compute Engine default service account](https://docs.cloud.google.com/compute/docs/access/service-accounts.md.txt#default_service_account)
- To connect to a node secured by Identity-Aware Proxy (IAP): [IAP-Secured Tunnel User](https://docs.cloud.google.com/iam/docs/roles-permissions/iap.md.txt#iap.tunnelResourceAccessor) (`roles/iap.tunnelResourceAccessor`) on your project


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


These predefined roles contain

the permissions required to connect to a login or compute node in a cluster. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to connect to a login or compute node in a cluster:

- To view a list of clusters: `hypercomputecluster.clusters.list`
- To view the details of a single cluster: `hypercomputecluster.clusters.get`
- To connect to a node:
  - `compute.instances.osLogin`
  - `iam.serviceAccounts.actAs`
- To connect to a node secured by IAP: `iap.tunnelInstances.accessViaIAP`


You might also be able to get
these permissions
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview.md.txt#predefined).

## Connect to a cluster

The following sections explain how to connect to a login node in a Slurm
cluster, or a compute node in a Slurm cluster or a managed compute cluster.

### Connect to a cluster's login node

To connect to a cluster's login node in a Slurm cluster by using SSH, complete
the following steps:

1. In the Google Cloud console, go to the **Clusters** page.

   [Go to Clusters](https://console.cloud.google.com/cluster-director/clusters/list)
2. In the **Clusters** table, in the **Name** column, click the name of the
   cluster that you want to connect to. A page that gives the details of the
   cluster appears, and the **Details** tab is selected.

3. Click the **Nodes** tab.

4. In the **Login nodes** section, in the **Connect** column, click the **SSH**
   button in the row that contains your login node. The **SSH-in-browser**
   window opens.

5. If prompted, then click **Authorize**. Connecting to your node can take up
   to a minute to complete.

### Connect to a cluster's compute node

To connect to a compute node in a Slurm cluster or a managed compute cluster by
using SSH, complete the following steps. To run a command across all compute
nodes in a managed instance group (MIG), see
[Run a command across compute nodes in a MIG](https://docs.cloud.google.com/cluster-director/docs/workloads/configure-mig.md.txt#run-command-mig).

1. In the Google Cloud console, go to the **Clusters** page.

   [Go to Clusters](https://console.cloud.google.com/cluster-director/clusters/list)
2. In the **Clusters** table, in the **Name** column, click the name of the
   cluster that you want to connect to. A page that gives the details of the
   cluster appears, and the **Details** tab is selected.

3. Click the **Nodes** tab.

4. In the **Compute nodes** section, click **SSH** in the row for the compute
   node that you want to connect to (or click the node name and then click
   **SSH**).

5. If prompted, then click **Authorize**. Connecting to your node can take up
   to a minute to complete.

## What's next

- [View cluster topology](https://docs.cloud.google.com/cluster-director/docs/monitor/view-topology.md.txt)

- [Submit and monitor jobs on Slurm clusters](https://docs.cloud.google.com/cluster-director/docs/workloads/configure-slurm.md.txt)

- [Submit and monitor jobs on managed compute clusters](https://docs.cloud.google.com/cluster-director/docs/workloads/configure-mig.md.txt)

- [Run health checks before running workloads](https://docs.cloud.google.com/cluster-director/docs/monitor/cluster-health.md.txt#verify-health)