Summary
Implement Kubernetes Job runtime to spawn MCP servers as ephemeral K8s Jobs, ideal for batch operations and one-shot tasks.
Parent Epic
Part of #1 - Production Kubernetes & Container Support
Use Cases
- Running data migrations via MCP
- Batch processing tasks
- One-time analysis jobs
- Resource-intensive operations with defined completion
RuntimeConfig Addition
pub enum RuntimeConfig {
// ... existing variants
KubernetesJob {
namespace: String,
image: String,
service_account: Option<String>,
resources: Option<ResourceRequirements>,
env: HashMap<String, String>,
env_from: Vec<EnvFromSource>,
volumes: Vec<Volume>,
ttl_seconds_after_finished: Option<i32>,
},
}
Catalog Example
servers:
- id: data-migration
runtime:
type: k8s-job
namespace: mcp-workloads
image: myregistry/migration-mcp:v1.2
service_account: mcp-job-runner
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "1Gi"
cpu: "1000m"
env:
DATABASE_URL: "${DATABASE_URL}"
ttl_seconds_after_finished: 3600
Implementation Details
Job Creation Flow
- Client calls tool on server
- Gateway creates K8s Job with generated name
- Wait for pod to be ready
- Stream stdio via pod exec/logs
- Job completes or times out
- Cleanup based on TTL
Communication Pattern
Gateway <--exec/logs--> Job Pod <--stdio--> MCP Server
Features Required
Acceptance Criteria
Dependencies
References
Summary
Implement Kubernetes Job runtime to spawn MCP servers as ephemeral K8s Jobs, ideal for batch operations and one-shot tasks.
Parent Epic
Part of #1 - Production Kubernetes & Container Support
Use Cases
RuntimeConfig Addition
Catalog Example
Implementation Details
Job Creation Flow
Communication Pattern
Features Required
Acceptance Criteria
type: k8s-jobin catalogDependencies
References