VScode Remote Development using SSH on Embedded System RB Pi5
Purpose:
Goal: Develop and edit Kubernetes code directly on a Raspberry Pi 5 using VS Code running on your PC. Why?
Headless Efficiency: You don't need to install a heavy GUI (Desktop Environment) on the Pi, saving RAM and CPU for your Kubernetes cluster.
Comfort: You get the full IntelliSense, debugging, and git integration of VS Code on your powerful desktop, while the code actually runs on the Pi.
Environment:
- Local Machine - A X86 Desktop (Ubuntu)
- Install Visual Studio Code
- Install Open SSH Client
- Install the Remote-SSH extension.
- Remote Host - Raspberry Pi 5. (Ubuntu)
- Install Open SSH Server
- Install Visual Studio Code Insiders.
- Working internet
Setting:
Step 1: Verify Connectivity
Before opening VS Code, ensure your PC can talk to the Pi via a standard terminal.
$ssh user@hostname_or_IP
If this works, you are ready to proceed.
Step 2: Install the Extension
- Open VS Code on your PC.
- Go to the Extensions view (Ctrl+Shift+X).
- Search for Remote
- SSHand install it.
Step 3: Connect to Host
- Open the Command Palette (F1 or Ctrl+Shift+P).
- Type and select:
Remote-SSH: Connect to Host... - Enter your Pi's connection details: user@hostname_or_IP.
- Password: Enter your Pi's password when prompted at the top of the screen.
Step 4: Start Developing
- Once connected, you will see a green indicator in the bottom-left corner: >< SSH: hostname.
- Click Open Folder in the "Explorer" view.
- You will see the file system of the Raspberry Pi, not your local PC. Select your Kubernetes project folder.
Pro Tip: SSH Keys (Passwordless Login)
To avoid typing your password every time you reconnect or open a new folder, set up SSH keys.
Generate a key on your PC:
$ ssh-keygen -t ed25519# Press Enter for defaultsCopy the key to the Pi:
$ ssh-copy-id user@hostname_or_IPNow, VS Code will connect instantly without prompting for a password!
Reference:
System Requirements and more detail will be in the VS code web.
Comments