CLI and SDK for creating, managing, and scaling Ray clusters on Kubernetes
Project description
Krayne
CLI and SDK for creating, managing, and scaling Ray clusters on Kubernetes.
Krayne wraps the KubeRay operator behind a clean, opinionated interface so ML practitioners can get distributed compute without touching Kubernetes manifests.
Quickstart
pip install krayne
Create a Ray cluster with a single command:
krayne create my-cluster --gpus-per-worker 1 --workers 2
Or use the Python SDK to define code and infrastructure together:
import ray
from krayne.api import managed_cluster
from krayne.config import ClusterConfig, WorkerGroupConfig
config = ClusterConfig(
name="hello-world",
worker_groups=[WorkerGroupConfig(replicas=2)],
)
with managed_cluster(config) as managed:
ray.init(managed.tunnel.client_url) # ray://localhost:... (tunneled)
@ray.remote
def hello(x):
return f"Hello from worker, {x}!"
futures = [hello.remote(i) for i in range(4)]
print(ray.get(futures))
ray.shutdown()
# Tunnels closed, then cluster deleted
Tunnels are opened by default — access the dashboard, notebook, and other services via localhost:
from krayne.api import managed_cluster
from krayne.config import ClusterConfig
config = ClusterConfig(name="my-cluster")
with managed_cluster(config) as managed:
# Tunnel (localhost) URLs via managed.tunnel
print(managed.tunnel.dashboard_url) # http://localhost:...
print(managed.tunnel.client_url) # ray://localhost:...
# In-cluster IPs via managed.cluster
print(managed.cluster.dashboard_url) # http://10.0.0.1:8265
# Tunnels closed, then cluster deleted
Features
- Zero-config defaults — every command works with no flags. Sensible defaults get you a working cluster instantly.
- CLI and SDK — the CLI is a thin shell over the Python SDK. Anything you do from the terminal, you can do from code.
- Functional API — stateless free functions, not class hierarchies. Easy to test, easy to compose.
- Pydantic config — validated configuration with YAML override support. No silent failures.
- Rich output — beautiful terminal tables via Rich, with
--output jsonfor scripting.
CLI Overview
krayne create <name> Create a new Ray cluster
krayne get List clusters in a namespace
krayne describe <name> Show detailed cluster info
krayne scale <name> Scale a worker group
krayne delete <name> Delete a cluster
All commands support -n/--namespace, --output json, and --debug flags.
Documentation
Full documentation is available at the Krayne docs site.
Requirements
- Python 3.10+
- A Kubernetes cluster with the KubeRay operator installed
- A valid kubeconfig (or running inside the cluster)
Development
# Clone and install
git clone https://github.com/roulbac/krayne.git
cd krayne
uv sync
# Run tests
uv run pytest
# Run integration tests (sandbox is provisioned automatically by test fixtures)
uv run pytest -m integration
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file krayne-0.1.0.tar.gz.
File metadata
- Download URL: krayne-0.1.0.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ad26d399515cd1a1e97e6270e1d6052c1aea68b81e6d245337f93efd50085a3
|
|
| MD5 |
62fcb27767e1a9dfc29e1f97b7ba6fc0
|
|
| BLAKE2b-256 |
083860a15da190e3a241248c3abb00af3116993e0e5e7566f6e05566e935e3d9
|
Provenance
The following attestation bundles were made for krayne-0.1.0.tar.gz:
Publisher:
publish.yml on roulbac/krayne
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krayne-0.1.0.tar.gz -
Subject digest:
6ad26d399515cd1a1e97e6270e1d6052c1aea68b81e6d245337f93efd50085a3 - Sigstore transparency entry: 1227131101
- Sigstore integration time:
-
Permalink:
roulbac/krayne@f4920de7637afa7d6ebc5c00bf801410838880bf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/roulbac
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4920de7637afa7d6ebc5c00bf801410838880bf -
Trigger Event:
release
-
Statement type:
File details
Details for the file krayne-0.1.0-py3-none-any.whl.
File metadata
- Download URL: krayne-0.1.0-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dafcd6e0e9c071d103e254cc1d0befa94442e248523c3d8020061760ca31b86c
|
|
| MD5 |
84e1325e345dc86176b7a4f5d43fccfb
|
|
| BLAKE2b-256 |
c376a82c9e6e3e145e4b15a986880b395a12e0b467dc40df1e3df4fedc332560
|
Provenance
The following attestation bundles were made for krayne-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on roulbac/krayne
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krayne-0.1.0-py3-none-any.whl -
Subject digest:
dafcd6e0e9c071d103e254cc1d0befa94442e248523c3d8020061760ca31b86c - Sigstore transparency entry: 1227131163
- Sigstore integration time:
-
Permalink:
roulbac/krayne@f4920de7637afa7d6ebc5c00bf801410838880bf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/roulbac
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4920de7637afa7d6ebc5c00bf801410838880bf -
Trigger Event:
release
-
Statement type: