Skip to content

Visual Studio Code

This page describes two methods for using Visual Studio Code with Kubernetes.

This is an easy way to develop and debug code directly in a container while having access to hardware resources such as GPUs.

As an example, you can start a Jupyter Node app to allocate CPU, GPUs, memory and persistent storage, and then connect to it from Visual Studio Code. You do not have to use the Jupyter web server, but can directly create and run regular Python files.

Kubernetes Tools

The Kubernetes extension provides many of the same features as Rancher, but directly in Visual Studio Code.

  1. Add the credentials file to ~/.kube/config.
  2. Install the extension.
  3. You should see icekube listed among clusters. If not, open the Command Palette (Ctrl+Shift+P) and Set Kubeconfig to ~/.kube/config.
  4. Open the Command Palette and choose Kubernetes: Use namespace, then enter your namespace.
  5. Open the extension in the sidebar, select icekube ➡ Workloads ➡ Deployments ➡ your Jupyter Node app name, then right-click on a deployment to see the available actions. You can then choose to Attach Visual Studio Code.

This will give you among other things

  • Log, debug, delete containers, and view the YAML specification.
  • Read Secrets and Config Maps.
  • Terminal for container shell access.

Remote-SSH

The Remote - SSH extension allows you to attach Visual Studio Code to containers over an SSH NodePort. You can then access the container file system to develop and run code directly inside a container.

  1. Read the SSH documentation to find your NodePort number.
  2. Open the Command Palette (Ctrl+Shift+P) and choose Remote SSH: Connect to Host... then e.g. root@nodeport.icedc.se:32722 where 32722 is your NodePort number.