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.
- Add the credentials file to
~/.kube/config
. - Install the extension.
- You should see
icekube
listed among clusters. If not, open the Command Palette (Ctrl+Shift+P) and Set Kubeconfig to~/.kube/config
. - Open the Command Palette and choose
Kubernetes: Use namespace
, then enter your namespace. - 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.
- Read the SSH documentation to find your NodePort number.
- Open the Command Palette (Ctrl+Shift+P) and choose
Remote SSH: Connect to Host...
then e.g.root@nodeport.icedc.se:32722
where32722
is your NodePort number.