marimo is an open-source Python notebook designed specifically for machine learning and AI. This tutorial shows you how to develop with marimo notebooks on CKS, including connecting to CoreWeave Object Storage for data access. 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.
- Install the marimo operator on your CKS cluster (for cluster administrators)
- Run notebooks with the CLI plugin (recommended for researchers)
- Connect to CoreWeave Object Storage to access data from your notebooks
- Deploy with manifests for advanced configuration
What you'll need
Before you start, you must have:
- A CKS cluster with available resources
kubectlinstalled and configured to access your cluster- Python 3.10+ with
piporuv - CoreWeave Intelligent CLI for storage setup
- S3cmd for storage setup
What you'll use
You’ll use these tools:
- marimo-operator: Manages notebook deployments on Kubernetes
- kubectl-marimo: CLI plugin for running notebooks on Kubernetes
- CoreWeave AI Object Storage: S3-compatible storage for data access
Install the marimo operator
Note that this section is primarily for cluster administrators who need to install the marimo operator on CKS clusters. If the operator is already installed on your cluster, skip to Install Kubernetes marimo CLI plugin. To use marimo within a CKS cluster, install the marimo operator by running the following commands:-
Install the operator:
-
Verify the operator is running:
The output should show the operator pod in a
Runningstate:
Install the marimo CLI plugin
The CLI plugin is the fastest way to run notebooks. It handles manifest generation, port forwarding, and credential management automatically. To install the marimo CLI plugin, run the following commands:-
Install
kubectl-marimo:
Run a marimo notebook on CKS
After installing the operator and CLI plugin, you can run marimo notebooks. If you’re new to marimo, you can use one of the pre-written CPU or GPU notebooks. For more information about these example notebooks, go to the marimo operator examples page.CPU notebookGPU notebook
-
Run and edit a notebook interactively by running the following command:
- Note: Replace
EXAMPLE_NOTEBOOK.pywith the path to a marimo notebook. If you don’t have a marimo notebook, you can create a file with a.pyextension to use as a starting point. You can also use one of the pre-written notebooks mentioned above, such as the CPU or GPU notebook.
- Uploads your notebook to the cluster
- Creates persistent storage for your changes
- Starts the marimo server
- Provides a URL where you can access your notebook. Your notebook opens at
http://localhost:<port>, which runs until you close the connection withctrl-C.
ctrl-Cand selecting to delete the pod, the plugin:- Syncs changes you made to your notebook back to your local machine
- Tears down your pod
- Note: Replace
-
To edit a notebook without storage sync and management, run the following command:
Specifying resources
You can configure notebook resources directly in your notebook files using Python metadata and frontmatter.In addition to resource specification,
marimo-operator will sandbox your environments through the marimo sandbox specification.Configuration fields
| Field | Description | Default |
|---|---|---|
title | Resource name in Kubernetes | filename |
image | Container image | ghcr.io/marimo-team/marimo:latest |
port | Server port | 2718 |
storage | Persistent volume size | none (ephemeral) |
resources | CPU, memory, and GPU requests/limits | none |
auth | Set to “none” to disable authentication | token auth |
env | Environment variables | none |
mounts | Data source URIs to mount | none |
Resource requests and limits
Specify CPU, memory, and GPU resources using Kubernetes resource quantity format. Python notebooks (.py):-
GPU workloads. For GPU workloads on CoreWeave, specifying
nvidia.com/gpuin limits is typically sufficient. The scheduler will place your notebook on an appropriate GPU Node. For advanced scheduling (specific GPU types, Node affinity), use manifest-based deployment. -
CRD information. For the full CRD specification including advanced features like
podOverrides,sidecars, and custom authentication, see the marimo-operator documentation.
Mount URI schemes
| Scheme | Description | Example |
|---|---|---|
cw:// | CoreWeave Object Storage | cw://bucket/path |
sshfs:// | SSH filesystem mount | sshfs://user@host:/path |
rsync:// | Local directory sync | rsync://./data:/notebooks |
Local and bi-directional syncing
Localrsync:// URIs (like rsync://./data) sync a local directory to the pod. Remote URIs (like rsync://user@host:/path) create continuous bi-directional sync.
Connect to CoreWeave AI Object Storage
Mount CoreWeave AI Object Storage buckets in your notebooks with automatic credential management.-
Login to the CoreWeave Intelligent CLI to use
cwiccommands:The following prompt appears and a browser opens the CoreWeave Console: - In the Console, create a new token by selecting Create Token and provide a name and expiration.
-
Paste the token secret into the
cwicprompt here: -
Use
cwicto create an access token for creating AI Object Storage buckets:- Note: Replace
TOKEN_NAMEwith your token name, for example,marimo-bucket-token. - Save the Access Key ID and Secret Key from the output.
- Note: Replace
-
Configure your local AI Object Storage credentials (one-time setup).
We’re creating an
.s3cfgfile becausecwicuses S3cmd for creating buckets.- Note: Replace the
access_keyandsecret_keyvalues with your actual Access Key ID and Secret Key. ReplaceAVAILABILITY_ZONEwith the your zone, for example,US-EAST-04A.
- Note: Replace the
-
Create a bucket.
- Note: Replace
BUCKET_NAMEwith your bucket name, for example,my-notebook-data.
- Note: Replace
-
Create a file and add it to the bucket:
- Note: Replace
BUCKET_NAMEwith your bucket name.
- Note: Replace
-
Deploy with storage mounted:
- Note: Replace
BUCKET_NAMEandNOTEBOOK_NAME.pywith the names of your bucket and notebook.
~/.s3cfgfile - no manualkubectl create secretrequired. - Note: Replace
-
Access your data in the notebook:
Files are mounted at
/home/marimo/notebooks/mounts/cw-0/: In the marimo notebook, access the mounted storage from the files menu under mounts > cw-0: You can also add this script to the notebook as an example of accessing the mounted storage:
Manually syncing and managing deployments
When you’re done editing, sync your changes back to your local file without stopping the instance:- Note: Replace
NOTEBOOK.pywith your notebook name.
- Note: Replace
NOTEBOOK.pywith your notebook name.
CLI plugin reference
Commands
edit
Run a notebook and launch the marimo editor| Option | Description |
|---|---|
-n, --namespace | Kubernetes namespace (default: “default”) |
--source | Data source URI to mount (cw://, sshfs://, rsync://) |
--dry-run | Print the generated YAML without applying |
--headless | Deploy without port-forward or browser (for CI/scripts) |
-f, --force | Overwrite existing deployment without prompting |
run
Deploy a notebook as a read-only application (useful for dashboards).edit.
sync
Pull changes from the cluster back to your local file.| Option | Description |
|---|---|
-n, --namespace | Kubernetes namespace |
-f, --force | Overwrite local file without prompting |
delete
Remove a notebook deployment from the cluster.| Option | Description |
|---|---|
-n, --namespace | Kubernetes namespace |
--delete-pvc | Remove persistent storage after deletion |
--no-sync | Delete without syncing changes back first |
status
List active notebook deployments.Deploy with manifests
For advanced users who need fine-grained control over deployments, you can create
MarimoNotebook resources directly.Basic manifest
-
Create a file named
notebook.yaml:notebook.yaml -
Apply the manifest:
-
Check the status:
The output shows your notebook and its status:
-
To access the notebook, set up port forwarding:
-
Get the URL with the access token by getting the Pod’s logs:
- Note: Replace
MARIMO_NAMEwith the manifest name.
- Note: Replace
-
Copy the URL with the access token and paste it into your browser. You should now see the notebook defined the manifest’s
sourcefield.
With storage (manual setup)
To manually add storage, complete the following steps:-
Create the credentials secret:
-
Add mounts to your manifest:
With GPU resources
To run notebooks with GPU access, specify resource requests and limits:podOverrides:
Clean up
Delete your notebook deployment:- Note: Replace
MARIMO_NAMEwith the name in the manifest.
Using
kubectl delete directly will not sync your changes back to your local file.- Run
kubectl marimo syncto sync local changes. - Run
kubectl marimo deleteto automatically sync before deletion. - Run
kubectl marimo delete --delete-pvcto also delete the persistent data.