DevPod enables you to create development environments by running Pods on your existing CKS resources. This tutorial teaches you how to set up and use DevPod for both basic and Docker-enabled development environments. In this tutorial, you will:Documentation Index
Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
Use this file to discover all available pages before exploring further.
- Learn how DevPod integrates with CKS to create development environments
- Set up DevPod on CKS, either:
- Basic setup without Docker: A simple development environment without Docker, suitable for most development tasks
- Advanced setup with Docker: A development environment with Docker support, enabling containerized development
- Access and verify your development environment using both SSH and web-based interfaces
- Understand how to manage and clean up DevPod workspaces
🚀 What you'll need
Before you start, you must have:
- A CKS cluster with available CPU or GPU resources
kubectlinstalled and configured to access your CKS cluster- A Virtual Server with access to your CKS cluster
- DevPod CLI installed on your Virtual Server
🛠️ What you'll use
You’ll use these tools and technologies:
- DevPod CLI: For creating and managing development environments
- Kubernetes Pod manifests: For defining your development environment configuration
- PyTorch container image: As the base development environment
- Docker-in-Docker (DinD): For Docker-enabled environments (advanced setup)
- VS Code: For development (either the browser-based or the desktop version)
Know before you go
Key concepts
- DevPod: A tool that creates development environments as Kubernetes Pods, allowing you to develop directly on your CKS cluster resources
- Pod manifest template: A Kubernetes Pod specification that DevPod uses to create your development environment
- Docker-in-Docker (DinD): A sidecar container that provides Docker functionality within your development environment
The DevPod CLI assumes that
kubectl is in your PATH, and that the kubectl context is set to the cluster you want to use.Environment setup and assumptions
- SUNK environment: The examples in this tutorial assume a SUNK environment for toleration specification. If you are not using a SUNK environment, adjust the toleration specification accordingly.
- PyTorch base image: You’ll use a PyTorch image as the base image, regardless of whether you’re using CPU or GPU resources.
- Namespace organization: Use the
devpodnamespace to keep your DevPod environments organized - this is the default namespace for the Kubernetes provider in DevPod.
1. Install DevPod CLI
Install the DevPod CLI on your Virtual Server by following the DevPod installation guide. The DevPod CLI should be installed and running on a Virtual Server that has access to your CKS cluster.2. Select a setup path
- Basic setup without Docker: A simple development environment without Docker, suitable for most development tasks
- Advanced setup with Docker: A development environment with Docker support, enabling containerized development
Basic setup without Docker
If your development environment does not require Docker, use this simplified configuration.1. Create the configuration files
First, create a directory for your DevPod configuration files. Then, create the example configuration files as described below:pod_manifest_template.yaml: A Kubernetes Pod manifest that DevPod uses as a template to provision your development environment.run_demo_gpu_cwsa.sh: A script that creates and starts your DevPod environment..devcontainer/devcontainer.json: A configuration file for the DevContainer IDE.
~/devpod-gpu-sidecar/.
Create the Pod manifest template
Create a file namedpod_manifest_template.yaml with the following content:
pod_manifest_template.yaml
- The
pod_manifest_template.yamlfile defines a Kubernetes Pod manifest that DevPod uses as a template to provision your development environment. - The Pod is created in the
devpodnamespace, in order to keep DevPod resources logically separated from other workloads. - The manifest specifies tolerations for both
sunk.coreweave.com/nodesandis_cpu_computeNode labels, allowing the Pod to be scheduled on Nodes with these taints. - The primary container uses the
pytorch/pytorch:2.4.1-cuda12.4-cudnn9-runtimeimage, mounts a sharedemptyDirvolume at/shared, and runs in a privileged security context to enable advanced development workflows that require elevated permissions.
Create the setup script
Next, create a file namedrun_demo_gpu_cwsa.sh with the following content:
run_demo_gpu_cwsa.sh
Create the .devcontainer configuration
Create a .devcontainer directory, then add a devcontainer.json file with the following content:
.devcontainer/devcontainer.json
2. Start the DevPod environment
Run the setup script to start your DevPod environment:Ctrl+C. Remove the debug flag in the script once you’ve verified that the setup is working properly.
Monitor the Pod status to ensure the container is ready:
3. Access your DevPod environment
Open another terminal in your Virtual Server, then list your DevPod workspaces usingdevpod ls:
devpod ssh:
IDE accessWhen you run
devpod ssh, DevPod automatically opens a browser-based VS Code IDE in your Virtual Server’s browser. This happens because the workspace is configured to use openvscode as the IDE (as shown in the devpod ls output).If the browser-based IDE doesn’t open automatically:- Ensure your Virtual Server has a browser installed and accessible
- Check that the DevPod workspace is running properly
- You can also access the IDE manually by running
devpod openin a separate terminal
4. Verify GPU access
Since PyTorch is the base image,nvidia-smi works on GPU systems. Use this to verify GPU access:
Advanced setup with Docker
If your development environment requires Docker, use this advanced configuration, which includes a Docker-in-Docker (DinD) sidecar container.1. Create the Docker-enabled configuration files
Create the Pod manifest template with Docker sidecar
Create a file namedpod_manifest_template.yaml with the following content:
pod_manifest_template.yaml
- The
pod_manifest_template.yamlfile defines a Kubernetes Pod manifest that DevPod uses as a template to provision your development environment. - The Pod is created in the
devpodnamespace, in order to keep DevPod resources logically separated from other workloads. - The manifest specifies tolerations for both
sunk.coreweave.com/nodesandis_cpu_computeNode labels, allowing the Pod to be scheduled on Nodes with these taints. - The primary container uses the
pytorch/pytorch:2.4.1-cuda12.4-cudnn9-runtimeimage, mounts a sharedemptyDirvolume at/shared, and runs in a privileged security context to enable advanced development workflows that require elevated permissions. - The manifest configures a Docker-in-Docker (DinD) sidecar container (
containers.dind), which allows the primary container to run Docker commands inside the Pod. - The DinD container exposes the Docker daemon on
tcp://0.0.0.0:2375without TLS, and disables Docker’s default TLS certificate directory for easier local development. - The
devpodcontainer sets theDOCKER_HOSTenvironment variable to connect to the DinD sidecar, enabling Docker CLI usage. - Both containers mount a shared workspace volume (
devpod), allowing files to be accessed between the DinD and primary containers. - The manifest uses
emptyDirvolumes for both Docker storage and shared tools, ensuring ephemeral, fast local storage within the Pod. - Both containers run in privileged mode, which is required for Docker-in-Docker and some advanced development workflows, but should be used with caution in production environments.
Create the setup script with Docker
Create a file namedrun_demo_gpu_cwsa.sh with the following content:
run_demo_gpu_cwsa.sh
Create the devcontainer configuration
Create a.devcontainer directory, then add a devcontainer.json file:
.devcontainer/devcontainer.json
2. Start the DevPod environment with Docker
Run the setup script to start your DevPod environment:Ctrl+C. Once you’ve verified that the setup is working properly, remove the debug flag from the script.
Monitor the Pod status to ensure both containers are ready:
3. Access your DevPod environment
Open another terminal in your Virtual Server, then list your DevPod workspaces usingdevpod ls:
devpod ssh:
IDE accessWhen you run
devpod ssh, DevPod automatically opens a browser-based VS Code IDE in your Virtual Server’s browser. This happens because the workspace is configured to use openvscode as the IDE (as shown in the devpod ls output).If the browser-based IDE doesn’t open automatically:- Ensure your Virtual Server has a browser installed and accessible
- Check that the DevPod workspace is running properly
- You can also access the IDE manually by running
devpod openin a separate terminal
4. Install Docker CLI
Useapt to install the Docker CLI that connects to the Docker sidecar. This is required to run Docker commands from the primary container.
5. Verify Docker connection
Test that Docker is working and connected to the sidecar container by runningdocker ps:
docker run hello-world:
6. Verify GPU access
Since PyTorch is the base image,nvidia-smi should work on GPU systems. Run nvidia-smi to verify GPU access:
Install full Docker with buildx support
For a complete Docker installation including buildx support, follow the official Docker installation steps: Update the package index:Use the full VS Code IDE
To use the full VS Code IDE for either setup path, first ensure VS Code is installed on the same local client that starts the DevPod. Then, modify yourrun_demo_gpu_cwsa.sh file to include the following changes for either setup path:
run_demo_gpu_cwsa.sh
devpod open.
Clean up
When you are finished with your DevPod environment, delete it usingdevpod delete:
kubectl delete namespace: