Skip to main content

Connect Local VS Code to Web-Based Notebooks

Use your local VS Code Studio to connect to an AI Platform pod and open web-based notebooks.

Prerequisites

  • VS Code installed
  • kubectl CLI installed and available in PATH
  • Access to Kubernetes cluster
  • Jupyter extension

Install Kubernetes extension

  1. Open VS Code on your local machine.

  2. From VS Code or your web browser, install the Kubernetes extension.

    k8s extension Kubernetes extension page

  3. If not already authenticated and kubeconfig file not configured, go to VS Code's command palette: Show and Run Commands > Kubernetes: Add existing cluster > Azure Kubernetes Service (AKS) > Select subscription > Select cluster

    Command palette Command palette

  4. If multiple clusters appear in Kubernetes extension sidebar, right-click on the cluster you'd like to connect and select Set as Current Cluster.

    Set current cluster Set current cluster

  5. Open the cluster menu and go to Workloads > Pods.

  6. Right-click the pod and select Attach Visual Studio Code.

    Attach pod
    Attach pod

Open notebook

After attaching, the VS Code Explorer shows the container’s file system.

  1. Navigate to the directory where your notebooks are stored. For example: /home/jovyan/src.
  2. Double-click the IPYNB file you want to open. VS Code should switch to Notebook Editor view.
  3. If necessary, install the Jupyter extension.
  4. Select the Python kernel inside the pod.
  5. Run notebook cells.
  6. Save changes.