VSCode on Compute Node

VSCode on Compute Node

Some VS Code extensions can launch excessive processes on login nodes and impact other users.
To avoid this, development work using VS Code should be performed on an interactive compute node.

This guide explains how to:

  • Perform the initial setup of a VS Code tunnel

  • Reconnect to the tunnel in future sessions



Requirements

  • SSH access to LCC or MCC

  • A GitHub or Microsoft account


Part 1 — Initial Setup (One-Time)

Step 1 — Log in via SSH

Open Windows Terminal or another SSH client (not VS Code).

ssh linkblue@mcc.uky.edu cd ~

 

Step 2 — Install the VS Code Server

Download and extract the VS Code CLI:

curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz tar -xf vscode_cli.tar.gz

 

Step 3 — Request an Interactive Compute Node

Example (8-hour session):

srun --nodes=1 --cpus-per-task=4 --time=8:00:00 --partition=normal --account=coa_PIlinkblue_uksr --pty bash -i

After allocation, your prompt will change to the compute node hostname.

 

Step 4 — Start the VS Code Tunnel

./code tunnel

Select the account you want to use (GitHub or Microsoft).

Terminal prompt from the VS Code tunnel command showing account selection options such as GitHub and Microsoft.
Terminal prompt from the VS Code tunnel command showing account selection options such as GitHub and Microsoft.

 

Step 5 — Authenticate in the Browser

  • Open the provided web link

  • Enter the authentication code

  • Sign in to the selected account

  • Confirm VS Code access

 

Step 6 — Name the Machine

You will be prompted to enter a machine name.

You may use:

  • the default hostname

  • or a descriptive name (for example, MCC)

 

Step 7 — Wait for Server Initialization

The VS Code server will download and start.

Your SSH session will display:

Server started

Terminal output showing the message Server started indicating the VS Code tunnel is active on the compute node.
Terminal output showing the message “Server started” indicating the VS Code tunnel is active on the compute node.

 

Step 8 — Connect from VS Code

In VS Code:

  1. Open Remote Explorer

  2. Click Tunnels

  3. Select your account

  4. Choose the tunnel name

A new VS Code window will open connected to the compute node.

Visual Studio Code interface showing the Remote Explorer panel with available tunnels listed.
Visual Studio Code interface showing the Remote Explorer panel with available tunnels listed.

Part 2 — Reconnecting in Future Sessions

Repeat these steps each time you want a compute node session.

Step 1 — SSH to Cluster

ssh linkblue@mcc.uky.edu

 

Step 2 — Request Interactive Node

srun --nodes=1 --cpus-per-task=4 --time=8:00:00 --partition=normal --account=coa_PIlinkblue_uksr --pty bash -i

 

Step 3 — Start Tunnel

cd ~ ./code tunnel

Authenticate if prompted.

Then connect via:

VS Code → Remote Explorer → Tunnels

Center for Computational Sciences