Skip to content
DocsAll docs
Console

Connection

Open a workspace from your terminal or editor over SSH, and reach its tool server.

Last updated

On this page

Overview

A workspace has no public address. kode opens an authenticated tunnel to it and runs your SSH client through that tunnel.

InterfaceCommandUse
Terminalkode workspaces sshA shell in the workspace.
Editors and SSH toolskode workspaces ssh-configEach workspace becomes an SSH host for editors, scp, and rsync.
Tool serverkode workspaces ideThe tool API on a local port.

The SSH user is kd. No SSH key is needed: the tunnel opens only for your CLI login, so the login is the credential. kode pins the workspace's host key and refuses the connection if it changes. If the platform stopped the workspace for idleness, kode starts it and waits up to 180 seconds. ssh and ide take a name, team/name, or an id. ssh-config writes hosts for your own workspaces only.

kode workspaces ssh-config writes ~/.ssh/kode_config, with one host per workspace, and includes it from ~/.ssh/config. Run it again after you create a workspace. Each host uses kode workspaces proxy as its ProxyCommand, so kode must be in the PATH of your editor.

ClientSetting
Terminalssh backend
VS Code, CursorRemote-SSH, host backend, folder /home/kl/workspace
JetBrains GatewaySSH, host backend, user kd, project /home/kl/workspace
File copyscp ./data.sql backend:workspace/

A running workspace reaches another workspace of the same owner by its name, for example http://blog-backend:8080. The name stays the same after a restart, so do not copy an IP address.

Tasks

Connect with SSH

Reason for the task

Open a shell in a workspace.

Job set-up

Procedure

  1. Run the command with the workspace name or id. Put extra SSH options after --, for example -- -A.

    CLI
    kode workspaces ssh backend

Close-out

  1. Make sure that whoami prints kd.

Open the workspace in an editor

Reason for the task

Work on the files of a workspace in your editor.

Job set-up

Procedure

  1. Write the SSH configuration.

    CLI
    kode workspaces ssh-config
  2. If the output names a directory to add to your PATH, add it.

  3. Open the workspace's host in your editor's remote SSH feature, and open /home/kl/workspace.

Close-out

  1. Make sure that the editor shows the workspace's files.

Open a tunnel to the tool server

Reason for the task

Call the tool API of a workspace from your computer.

Job set-up

Procedure

  1. Start the tunnel and keep it running. Use --port PORT for another local port.

    CLI
    kode workspaces ide backend
  2. Run this check from a second terminal.

    CLI
    curl http://localhost:7788/healthz

Close-out

  1. Make sure that the output contains "ok":true. Stop the tunnel with Ctrl+C.

Troubleshooting

SymptomPossible causeCorrective action
… is stopped; start it from the consoleYou stopped the workspace; kode restarts only idle-stopped workspaces.Start it. See Start a workspace.
no workspace backendNo workspace of yours has this name.Run kode workspaces list and use the name or id it shows. For a team workspace, use team/name.
… did not become ready: and a reasonThe workspace was not ready within 180 seconds.Read the reason, and show the status.
503 with the workspace has not reported its host key yetThe workspace is still starting.Wait a few seconds and try again.
gateway unreachable: HTTP error: 502 Bad Gateway right after a restartThe workspace is ready, but the gateway has not opened the tunnel yet.Wait five seconds and connect again.
Connection closed by remote host from an editorkode is not in the editor's PATH.Add it to PATH and restart the editor.