# Integration with Kubernetes Clusters

> Run the steps of your pipelines as pods in a Kubernetes cluster of your own.

Web page: https://docs.cadence.ci/en/how-it-works/kubernetes

**Cadence.CI** integrates with Kubernetes so that Mélodium runners are deployed as pods directly within your cluster. Pipeline execution stays inside your infrastructure, using your existing networking, storage, and compute policies.

## How It Works

A lightweight Kubernetes Controller is deployed in your cluster. It watches for runner provisioning requests from Cadence.CI and creates the corresponding pods. When a job completes, it tears down those pods. All interactions with your cluster go exclusively through the controller.

```mermaid
flowchart LR
  cadence["Cadence.CI"]
  controller["Kubernetes Controller\n(in your cluster)"]
  pods["Runner Pods"]

  cadence -->|runner request| controller
  controller -->|create / delete pods| pods
  pods -.->|logs + telemetry| cadence
```

## Setup Steps

1. **Deploy the controller**: install the Cadence.CI Kubernetes Controller into your cluster. It registers itself with Cadence.CI and handles communication between Cadence.CI and your cluster's API server.
2. **Configure cluster access**: the controller uses a service account scoped to just the permissions needed to create and delete runner pods and their supporting `ServiceAccount`/`Role`/`RoleBinding` objects.
3. **Runner deployment**: when a pipeline runs, Mélodium runners are created as pods in your cluster, using the namespace and resource quotas you configure.
4. **Direct execution**: pipeline steps execute inside your cluster, with direct access to cluster-internal services and storage.

## Benefits

- **Security**: data remains within your Kubernetes environment throughout execution.
- **Cost efficiency**: runners use your existing cluster capacity directly.
- **Compliance**: compute stays within your designated cluster, meeting data residency requirements.
- **Scalability**: Kubernetes' scheduler handles pod placement and resource allocation automatically.
- **Self-healing**: if a runner pod is evicted or crashes, Kubernetes reschedules it and Cadence.CI retries the affected work.

## Self-Managed vs. Melodium-Operated Clusters

Clusters registered with Cadence.CI are one of three service modes:

- **Self-managed**: a cluster you own and operate, registered with your own cluster token. This is the model described above, everything runs on your infrastructure.
- **Shared**: a cluster operated by Melodium, available to organizations on eligible plans. Runners still execute as isolated pods with scoped, per-job service accounts, on Melodium infrastructure shared across organizations.
- **Dedicated**: a cluster operated by Melodium and reserved for a single organization.

The pod-level architecture, controller, scoped service accounts, cluster access limited to the controller, is the same across all three modes. Self-managed clusters run entirely within infrastructure you control; shared and dedicated clusters run on infrastructure Melodium operates on your behalf.

## Available Configurations

While Cadence.CI can run on any standard Kubernetes distribution, pre-built cluster configurations are available for specific providers. See the pages in this section for provider-specific setup guides.
