> ## Documentation Index
> Fetch the complete documentation index at: https://docs.draftt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Kubernetes

Connect your Kubernetes clusters to Draftt to detect version compatibility issues, track configuration drift, and get actionable upgrade plans. Draftt uses a lightweight Helm-based collector deployed into your cluster.

## Prerequisites

* A Kubernetes cluster with `kubectl` configured and pointing to the correct context
* [Helm](https://helm.sh/docs/intro/install/) installed on your machine
* A Draftt account with tenant admin permissions (to create an access key)

## Setup

<Steps>
  <Step title="Select a cluster">
    In Draftt, go to **Integrations > K8s Explorer > Add**. Select the cluster you want to connect.
  </Step>

  <Step title="Add the Draftt Helm repo">
    Add the Draftt Helm chart repository and update:

    ```bash theme={null}
    helm repo add draftt-io https://draftt-io.github.io/helm-charts
    helm repo update
    ```
  </Step>

  <Step title="Create a Draftt API access key">
    Navigate to **Settings > [Access Keys](https://app.draftt.io/settings/access-keys)** in Draftt. Create a new access key with **tenant admin** permissions. Save the key -- you will need it in the next step.
  </Step>

  <Step title="Create a Kubernetes secret">
    Draftt Explorer is a collector tool. We recommend deploying it in a `monitoring` namespace (if one exists), but any namespace works.

    Create a secret that stores your Draftt API key securely:

    ```bash theme={null}
    kubectl create secret generic draftt-api-token \
      --from-literal=drafttApiToken=<YOUR_API_KEY> \
      -n monitoring
    ```

    <Note>
      Make sure your `kubectl` context is pointing to the correct cluster before running this command.
    </Note>
  </Step>

  <Step title="Install the Helm chart">
    Install the Draftt Explorer chart:

    ```bash theme={null}
    helm install draftt-explorer draftt-io/draftt-explorer \
      --set appConfig.clusterIdentifier="<YOUR_K8S_CLUSTER_IDENTIFIER>" \
      --set appConfig.namespace="monitoring" \
      -n monitoring
    ```

    Replace `<YOUR_K8S_CLUSTER_IDENTIFIER>` with a name that identifies this cluster in Draftt (e.g. `production-us-east-1`, `staging-eu`).
  </Step>

  <Step title="Validate the integration">
    Run the collector job manually to verify everything is working:

    ```bash theme={null}
    kubectl create job --from=cronjob/draftt-explorer draftt-test-run -n monitoring
    ```

    Check the job logs to confirm data was sent to Draftt successfully. Once validated, the collector runs on its scheduled cron interval automatically.
  </Step>
</Steps>

## What Draftt Collects

The Explorer is a **read-only collector**. It queries the Kubernetes API for resource metadata and sends it to Draftt for analysis. It does not modify any cluster resources.

Draftt governs workloads (Deployments, StatefulSets, DaemonSets, Jobs, CronJobs), networking (Services, Ingress, NetworkPolicies), security (ServiceAccounts, Roles, ClusterRoles, RBAC bindings), configuration (ConfigMaps, Secrets), and storage (PersistentVolumes, PersistentVolumeClaims, StorageClasses).

## Supported Environments

The Helm-based collector works with any Kubernetes distribution: managed services (EKS, AKS, GKE), self-managed clusters, and on-premises deployments. Connect multiple clusters by repeating the setup for each one.

## Verifying Your Connection

After the test job completes, return to **Integrations > K8s Explorer** in Draftt. The connected cluster shows a status:

* **Healthy** -- The collector is running and Draftt is receiving data.
* **Unhealthy** -- Check that the API key secret exists in the correct namespace, the Helm chart is installed, and the CronJob is scheduled.

## Troubleshooting

**Job fails with authentication error:** Verify the `draftt-api-token` secret exists in the correct namespace and contains a valid API key with tenant admin permissions.

**No data appearing in Draftt:** Confirm the `clusterIdentifier` value matches what you expect in the Draftt dashboard. Check the job logs with `kubectl logs job/draftt-test-run -n monitoring`.

**Helm install fails:** Ensure the Draftt Helm repo was added and updated (`helm repo update`). Verify the target namespace exists (`kubectl create namespace monitoring` if needed).
