> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-integration/troubleshooting-and-resources/troubleshoot-harness-ci/k8s-support-bundle.md).

# Kubernetes support bundle for CI

Diagnostic data the Harness Delegate collects from failed Kubernetes CI stages, what it contains, how it is stored, who can access it, and how to opt out.

{% hint style="success" %}
This feature is in [Limited GA](#user-content-fn-1)[^1] and requires enablement. [View all early access features.](https://developer.harness.io/release-notes/features.md)

{% @harness-feature-flag-access/request-feature-flag-access module="continuous-integration" pagePath="continuous-integration/troubleshooting-and-resources/troubleshoot-harness-ci/k8s-support-bundle" pageTitle="Kubernetes%20support%20bundle%20for%20CI" featureFlags="%5B%7B%22name%22%3A%22Kubernetes%20support%20bundle%20for%20CI%22%2C%22key%22%3A%22HARNESS\_DELEGATE\_SUPPORT\_BUNDLE\_COLLECTION%22%2C%22status%22%3A%22LIMITED\_GA%22%2C%22description%22%3A%22When%20a%20CI%20stage%20on%20a%20Kubernetes%20build%20infrastructure%20fails%2C%20the%20delegate%20collects%20a%20redacted%20diagnostic%20bundle%20from%20the%20build%20pod's%20namespace%20and%20uploads%20it%20to%20Harness-managed%20storage.%22%7D%5D" %}
{% endhint %}

When a CI stage running on a Kubernetes build infrastructure fails, the Harness Delegate can collect a diagnostic **support bundle** about the build pod and upload it to Harness-managed storage. Harness Support uses the bundle, along with your pipeline logs, to diagnose cluster-related failures such as network policy denials, image pull errors, scheduling issues, OOM kills, evictions, and volume mount failures.

This page describes what is collected, the Kubernetes permissions required, where the bundle is stored, who can access it, and how to disable collection.

{% hint style="info" %}
This feature applies **only** to CI stages running on the **Kubernetes cluster build infrastructure**. It is not used for Harness Cloud, self-managed VM, or Local/Docker build infrastructures.
{% endhint %}

***

### When the support bundle is collected <a href="#when-the-support-bundle-is-collected" id="when-the-support-bundle-is-collected"></a>

A bundle is collected only when **both** of the following are true:

1. Harness has enabled the feature flag `HARNESS_DELEGATE_SUPPORT_BUNDLE_COLLECTION` for your account.
2. The CI stage **failed**, errored, or timed out.

Successful or aborted stages never produce a bundle. There is no stage-level setting; the account flag is the only control.

Collection happens during stage cleanup, after the stage has already finished. The delegate collects and uploads the bundle **before** it deletes the build pod, so the pod's final state is captured. The whole step is best-effort and bounded to **90 seconds**:

* It never changes the stage's status or error message.
* If collection or upload fails or runs out of time, the delegate abandons it and continues with pod cleanup.

{% hint style="info" %}
**Cleanup of failed stages takes slightly longer**

Because the bundle is collected before the build pod is deleted, cleanup of a failed stage takes longer than usual, by up to 90 seconds. The stage and pipeline results are reported without waiting for this. During that time the build pod and its resources stay in the namespace, and the cleanup task occupies the delegate. Successful stages are cleaned up as usual.
{% endhint %}

***

### What is collected <a href="#what-is-collected" id="what-is-collected"></a>

The delegate queries the Kubernetes API for the data listed below, packages it into a single `support-bundle.tar.gz` archive, and uploads it. Nothing runs inside the build pod: the delegate does not `exec` into containers or read container logs.

All Kubernetes API calls are read-only (`get` and `list`) and namespaced calls are scoped to the build pod's own namespace. Go to [Kubernetes permissions required](#kubernetes-permissions-required) to review the single cluster-scoped exception.

| File in the bundle            | Source                                                                                                    | Sanitization applied before upload                                                                                                                                          |
| ----------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `metadata.json`               | Collection time, namespace, pod and node name, service account name, container images, K8s server version | None (identifiers only)                                                                                                                                                     |
| `pod.json`                    | The failed build pod's spec and status, including container exit codes and termination messages           | Every `env` value replaced with `env vars redacted for security` (names kept); `valueFrom` and `envFrom` removed, so referenced Secret and ConfigMap names are not included |
| `all-pods.json`               | Up to the 100 most recently created pods in the namespace                                                 | Same env redaction applied to every pod                                                                                                                                     |
| `node.json`                   | The node the build pod ran on (capacity, allocatable, conditions, kernel version)                         | None (node-level metadata only)                                                                                                                                             |
| `events.json`                 | The build pod's own events, then the most recent namespace events, up to 100 in total                     | None                                                                                                                                                                        |
| `resourcequotas.json`         | Resource quotas in the namespace                                                                          | None                                                                                                                                                                        |
| `limitranges.json`            | Limit ranges in the namespace                                                                             | None                                                                                                                                                                        |
| `networkpolicies.json`        | Network policies in the namespace                                                                         | None                                                                                                                                                                        |
| `persistentvolumeclaims.json` | PVCs in the namespace                                                                                     | None                                                                                                                                                                        |
| `configmaps.json`             | ConfigMaps in the namespace                                                                               | `.data` replaced with a count and list of key names; `.binaryData` removed. **Values are never included.**                                                                  |
| `serviceaccounts.json`        | ServiceAccounts in the namespace                                                                          | Default API response (metadata, labels, annotations, image-pull-secret references by name). **No tokens are read or included.**                                             |
| `network-diagnostics.txt`     | The Kubernetes API endpoint the delegate used                                                             | None. In-pod DNS, routes, and sockets are not collected because the delegate does not run inside the build pod.                                                             |

Namespace-wide lists are capped so that a busy or shared namespace cannot produce an oversized bundle: pods and events keep the 100 most recent items, and other resource lists return at most 100 items. A list that cannot be read is omitted, and the rest of the bundle is still produced.

{% hint style="info" %}
**Container logs are not included**

The collector does not read container logs. Anything your steps print appears only in the standard pipeline log viewer, not in the bundle.
{% endhint %}

### What is never collected <a href="#what-is-never-collected" id="what-is-never-collected"></a>

The collector contains no path that reads or transmits any of the following:

* **Kubernetes Secrets:** There is no `get`, `list`, or `watch` call against the `secrets` resource in any namespace.
* **ServiceAccount tokens:** No calls against the `serviceaccounts/token` subresource or the `tokenrequests` API.
* **Container logs:** No calls against `pods/log`.
* **ConfigMap values:** Only key names are retained.
* **Environment variable values:** Masked in every container (init, regular, and ephemeral) of every pod in the bundle.
* **Resources from any other namespace:** Every namespaced API call is pinned to the build pod's namespace.

***

### Kubernetes permissions required <a href="#kubernetes-permissions-required" id="kubernetes-permissions-required"></a>

The delegate calls the Kubernetes API with the same credentials it uses to create and delete the build pod. These come from the Kubernetes connector of your build infrastructure, for example the delegate's own ServiceAccount when the connector inherits from the delegate. No extra permissions are added to the build pod's ServiceAccount.

If a permission is missing, the collector **fails open**: that file is left out of the bundle and a warning is written to the delegate log. The build is not affected.

**Namespaced permissions (in the build pod's namespace)**

| API group           | Resource                 | Verbs         |
| ------------------- | ------------------------ | ------------- |
| (core)              | `pods`                   | `get`, `list` |
| (core)              | `events`                 | `list`        |
| (core)              | `resourcequotas`         | `list`        |
| (core)              | `limitranges`            | `list`        |
| (core)              | `persistentvolumeclaims` | `list`        |
| (core)              | `configmaps`             | `list`        |
| (core)              | `serviceaccounts`        | `list`        |
| `networking.k8s.io` | `networkpolicies`        | `list`        |

**Cluster-scoped permission**

| API group | Resource | Verbs | Why                                                                                                                                                                                                                                                |
| --------- | -------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| (core)    | `nodes`  | `get` | Reads the **single** node that the build pod ran on, to capture node conditions (memory, disk, and PID pressure), capacity, allocatable resources, and kernel version. These are needed to diagnose eviction, OOM, and ephemeral-storage failures. |

If your RBAC policy does not allow node reads, the bundle is still produced without `node.json`.

***

### Network access <a href="#network-access" id="network-access"></a>

Harness issues the delegate a short-lived upload URL that is scoped to the single bundle object. The delegate holds no storage credentials. It uploads in one of two ways:

1. **Direct:** an HTTPS `PUT` to the object storage endpoint (`storage.googleapis.com` on Harness SaaS).
2. **Fallback:** if the direct upload is blocked or fails, an HTTPS `POST` to the Harness cache service on your Harness host (for example, `app.harness.io`), authenticated with a short-lived account token. The fallback path accepts bundles up to 50 MB.

If your delegate can reach your Harness host but not the object storage endpoint, the fallback path is used automatically.

***

### Where bundles are stored <a href="#where-bundles-are-stored" id="where-bundles-are-stored"></a>

|                           |                                                                                                                                                    |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Storage backend**       | A dedicated, Harness-managed object storage bucket for each Harness cluster. It is separate from CI step log storage and from build cache storage. |
| **Object key path**       | Account-prefixed, then organization, project, pipeline, pipeline execution ID, and stage identifier. One bundle per failed stage run.              |
| **Public access**         | Blocked on the bucket. Objects are not publicly readable.                                                                                          |
| **Encryption in transit** | TLS for all uploads.                                                                                                                               |
| **Encryption at rest**    | Default encryption of the underlying object storage.                                                                                               |

***

### Retention <a href="#retention" id="retention"></a>

Bundles are deleted automatically **90 days** after upload.

If you need a specific bundle deleted sooner (for example, after a support case is closed), contact [Harness Support](mailto:support@harness.io) and include the pipeline, execution, and stage identifiers.

***

### Who can access the bundle <a href="#who-can-access-the-bundle" id="who-can-access-the-bundle"></a>

* **Customer users:** bundles are not currently downloadable from the Harness UI or API. If you want a copy of a bundle for your own analysis, request it from [Harness Support](mailto:support@harness.io).
* **Harness employees:** Harness Support and CI engineers can read bundles when diagnosing an issue for your account, under Harness's standard access controls and auditing for customer data. The delegate can only write its own bundle object, through the short-lived upload URL, and cannot read any bundle.

***

### How to disable collection <a href="#how-to-disable-collection" id="how-to-disable-collection"></a>

Contact [Harness Support](mailto:support@harness.io) and ask for the `HARNESS_DELEGATE_SUPPORT_BUNDLE_COLLECTION` feature flag to be turned off for your account. Collection stops for all stages on the next failure.

You can also remove the RBAC permissions listed in [Kubernetes permissions required](#kubernetes-permissions-required) from the connector's credentials. The collector then produces only the files it can still read. Most of these permissions are also needed to run builds, so turning off the flag is the recommended way to opt out.

### Verify whether collection ran <a href="#verify-whether-collection-ran" id="verify-whether-collection-ran"></a>

Nothing is added to the step logs. Check the delegate log for lines that start with `Support bundle (delegate):` around the time the stage failed. A `collection complete` line followed by an `upload=ok` result means a bundle was uploaded.

***

### Related resources <a href="#related-resources" id="related-resources"></a>

* Go to [Troubleshoot CI](https://developer.harness.io/continuous-integration/troubleshooting-and-resources/troubleshoot-harness-ci/troubleshooting-ci.md) to review common CI issues and solutions.
* Go to [Debug with SSH](https://developer.harness.io/continuous-integration/troubleshooting-and-resources/troubleshoot-harness-ci/debug-mode.md) to troubleshoot remote builds interactively.
* Go to [Troubleshoot builds with Harness AI](https://developer.harness.io/continuous-integration/troubleshooting-and-resources/troubleshoot-harness-ci/ai.md) to use AI-assisted diagnostics.

{% @harness-feedback/feedback %}

[^1]: On by default, ready for production use and rolling out to every Harness environment incrementally. If you want it before it reaches your environment, request access and Harness will turn it on for your account. Rollout happens in stages, so a feature can reach some environments a week or two before others. Harness can also turn it off via the same **Request access** process for your account if you need it off.
