Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
k8s-maestro
A Kubernetes workflow orchestrator for Rust with minimal requirements and full power.
k8s-maestro is a Rust library that provides a high-level, type-safe API for orchestrating complex workflows on Kubernetes. It abstracts away the complexity of managing Kubernetes resources while giving you full control when you need it.
What k8s-maestro Does
k8s-maestro helps you:
- Run Jobs on Kubernetes - Execute containerized workloads as Kubernetes Jobs with automatic retries, resource limits, and cleanup
- Build Multi-step Workflows - Chain multiple jobs together with dependencies, parallel execution, and conditional logic
- Expose Services - Create Services and Ingress resources to make your workloads accessible
- Manage Configuration - Handle ConfigMaps, Secrets, and environment variables seamlessly
- Add Sidecars - Attach logging, monitoring, or utility containers to your workflows
- Persist Data - Use PersistentVolumeClaims for stateful workloads
Key Features
| Feature | Description |
|---|---|
| Workflow Engine | Define multi-step workflows with dependencies, parallelism, and conditional execution |
| Step Types | Kubernetes Jobs, exec steps, WASM modules, and custom step implementations |
| Clonable Client | MaestroK8sClient implements Clone for easy sharing across multiple workflows and steps |
| Networking | Built-in Service and Ingress builders with TLS support |
| Sidecars | Add logging, metrics, or custom sidecar containers to any step |
| Checkpointing | Automatic state persistence for long-running workflows |
| Security | RBAC, network policies, and pod security context support |
| Builder Pattern | Fluent, type-safe API for constructing resources |
| Test Infrastructure | Unit, integration, and E2E tests with Kind clusters |
Installation
Add to your Cargo.toml:
[]
= "1.0"
Feature Flags
k8s-maestro uses feature flags to minimize dependencies and ensure compatibility with your Kubernetes cluster.
Kubernetes Version Features (Required)
You must enable one Kubernetes version feature matching your cluster version:
= { = "1.0", = ["k8s_v1_28"] }
| Feature | Cluster Version | When to Use |
|---|---|---|
k8s_v1_28 |
Kubernetes 1.28+ | Default choice for most clusters |
k8s_v1_29 |
Kubernetes 1.29+ | If using 1.29-specific APIs |
k8s_v1_30 |
Kubernetes 1.30+ | If using 1.30-specific APIs |
k8s_v1_31 |
Kubernetes 1.31+ | If using 1.31-specific APIs |
k8s_v1_32 |
Kubernetes 1.32+ | Latest Kubernetes features |
Note: These features enable the
kubeandk8s-openapicrates with the correct API version. Using a lower version (e.g.,k8s_v1_28) on a newer cluster works fine for common resources.
Optional Features
| Feature | Description | Dependencies Added |
|---|---|---|
exec-steps |
Execute local shell commands and git operations as workflow steps. Useful for CI/CD pipelines that need to clone repos, run scripts, or compute checksums before/after Kubernetes jobs. | git2, sha2, tempfile |
Example with exec-steps:
= { = "1.0", = ["k8s_v1_28", "exec-steps"] }
Default Features
By default, k8s-maestro enables:
k8s_v1_28- Kubernetes 1.28 API supportexec-steps- Local command execution
To disable defaults and select only what you need:
= { = "1.0", = false, = ["k8s_v1_30"] }
Migrating from v0.3.0?
See the Migration Guide for updating to the new workflow-centric API.
Client Cloning
MaestroK8sClient implements Clone, making it cheap and easy to share across multiple workflows:
let k8s_client = new.await?;
// Clone is lightweight - just increments an Arc counter
let workflow1 = new
.add_step
.build;
let workflow2 = new
.add_step
.build;
// Get the underlying Client when needed
let underlying_client = k8s_client.into_inner;
Key benefits:
- Zero-cost cloning - Only increments an
Arcreference counter - Thread-safe - Share across async tasks without synchronization
- Flexible - Use
into_inner()to extract the underlyingClientwhen needed
Quick Start
Simple Job
use ;
use KubeJobStep;
use MaestroK8sClient;
async
ETL Pipeline with Dependencies
use ;
use DependencyChain;
use KubeJobStep;
use MaestroK8sClient;
async
Service with Ingress
use ;
use KubeJobStep;
use MaestroK8sClient;
use BTreeMap;
async
API Documentation
| Module | Description |
|---|---|
| Client API | Main client for interacting with Kubernetes |
| Workflow API | Workflow definition and execution |
| Steps API | Step types (Jobs, exec, custom) |
| Networking API | Services, Ingress, DNS |
Examples
The examples directory contains comprehensive examples:
| Example | Description |
|---|---|
| use_workflow_builder.rs | Building workflows with WorkflowBuilder |
| apply_and_watch_workflow.rs | Watching workflow execution |
| delete_workflow.rs | Cleaning up workflow resources |
| use_services.rs | Creating and managing services |
| use_sidecar.rs | Adding sidecar containers |
| multi_step_workflow.rs | Multi-step workflows |
| dependency_system.rs | Using the dependency system |
AI Assistant Integration
k8s-maestro includes a dedicated AI assistant skill to help you integrate the library into your projects. The k8s-maestro-integrator skill provides:
- Smart Resource Selection - Guidance on when to use Jobs, Pods, or Workflows
- Integration Patterns - API vs channel integration strategies
- Feature Detection - Automatic detection of required features based on cluster version
- Code Generation - Generate workflow and test code from descriptions
- Testing Patterns - Unit, integration, and E2E test patterns with Kind
Installation
# Using skills.sh (recommended)
Example Usage
You: I need to create an ETL pipeline that extracts data from an API,
transforms it with Python, and loads it into PostgreSQL.
AI: [Provides complete Rust implementation with WorkflowBuilder,
KubeJobStep, dependency chains, and proper error handling]
See the skill documentation for details.
Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Write tests for your changes (TDD approach)
- Ensure all tests pass (
cargo test --verbose) - Run clippy (
cargo clippy) - Format your code (
cargo fmt) - Commit and create a Pull Request
Testing
# Unit tests (fast, no cluster needed)
# Integration tests (requires Docker)
# Specific test
License
Dual-licensed under:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
Contact
- André Claudino - @andreclaudino
- Pedro Braga - @braga-rp
- Romulo Tavares - @tavaresrft