> 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/resilience-testing/chaos-engineering/use-chaos-engineering/infrastructure/types/legacy-infra/kubernetes.md).

# Kubernetes Chaos Infrastructure

This topic describes the following:

* [What is Dedicated Chaos Infrastructure?](#what-is-harness-chaos-infrastructure)
* [Resource Requirements](#chaos-infrastructure-requirements)
* [Installation steps](#install-dedicated-chaos-infrastructure)
* [Validate the installation](#validate-installation)
* [Disable the infrastructure](#disable-infrastructure)

### What is Harness Chaos Infrastructure? <a href="#what-is-harness-chaos-infrastructure" id="what-is-harness-chaos-infrastructure"></a>

Harness Chaos Infrastructure (also known as Legacy Kubernetes Infrastructure) uses a dedicated infrastructure to facilitate and execute chaos experiments.

{% hint style="info" %}
Unless specified, chaos infrastructure refers to the dedicated chaos infrastructure (or legacy chaos infrastructure), and **NOT** DDCR.
{% endhint %}

### Chaos infrastructure requirements <a href="#chaos-infrastructure-requirements" id="chaos-infrastructure-requirements"></a>

The table below lists the chaos infrastructure execution plane components and the required resources for Legacy Kubernetes Infrastructure. You can install these components in your target cluster, allowing the chaos infrastructure to run experiments here. Chaos infrastructure runs within your target environment to aid HCE in accessing the target resources and injecting chaos at a cloud-native scale.

| Deployment          | Container           | <p>CPU<br>Required</p> | <p>Memory<br>Required</p> | Image                                       |
| ------------------- | ------------------- | ---------------------- | ------------------------- | ------------------------------------------- |
| chaos-operator-ce   | chaos-operator-ce   | 125m                   | 300M                      | docker.io/harness/chaos-operator            |
| chaos-exporter      | chaos-exporter      | 125m                   | 300M                      | docker.io/harness/chaos-exporter            |
| subscriber          | subscriber          | 125m                   | 300M                      | docker.io/harness/chaos-subscriber          |
| workflow-controller | workflow-controller | 125m                   | 300M                      | docker.io/harness/chaos-workflow-controller |

### Install Dedicated Chaos Infrastructure <a href="#install-dedicated-chaos-infrastructure" id="install-dedicated-chaos-infrastructure"></a>

You can enable chaos **on existing infrastructure** that uses a Harness cluster connector (also known as Harness Kubernetes connector) or **on new infrastructure**.

{% hint style="info" %}
You can choose between Kubernetes and Kubernetes (Harness infrastructure). The former refers to a dedicated infrastructure whereas the latter refers to Harness Delegate.
{% endhint %}

#### On Existing Infrastructure <a href="#on-existing-infrastructure" id="on-existing-infrastructure"></a>

To enable chaos on an existing Harness Kubernetes connector:

1. Go to **Chaos > Environments**, and then select the environment you want to add chaos infrastructure to.
2. On the environment details page, select **+ Enable Chaos**.
3. On the next screen, select where to add chaos infrastructure, and then select **Continue**.
4. If you selected **On Existing Infrastructures**, on the next screen, select any connector under the **Project**, **Organization**, or **Account** scope. Select **Continue**.

   ![Chaos Infrastructure in Existing Infra](/files/FXrkKclgMnbyyrmNm4xf)

{% hint style="info" %}
**NOTE**

A Harness Kubernetes connector with: \* **Cluster-wide read/write access** can be used to set up chaos infrastructure in cluster scope and namespace scope. \* **Specific namespace access** can be used to set up a chaos infrastructure in that specific Kubernetes namespace scope only. \* **Cluster-wide read access** cannot be used to set up a chaos infrastructure.
{% endhint %}

5. The **Configure Chaos Infrastructure** screen appears. Select the installation type, access type, namespace, and service account name. Select **Next**.

Under **Choose Access Type**, choose one of the following modes.

* **Cluster Wide:** This mode of infrastructure installation allows targeting resources across the entire cluster, in all the namespaces, as part of an experiment.
* **Namespace Mode:** This mode of infrastructure installation allows targeting resources only in the namespace where the chaos infrastructure is deployed.

By default, chaos is installed in the `hce` namespace and uses `hce` service account, which you can configure under the K8s cluster details.

Optionally, you can specify the node selectors and Kubernetes toleration for chaos infrastructure deployment.

{% hint style="info" %}

* There can only be one cluster-wide chaos infrastructure per cluster.
* There may be multiple namespace-scoped chaos infrastructures per cluster.
  {% endhint %}

![Configure Chaos Infrastructure](/files/10WYOoKdZk5MGuGYbqwu)

6\. The **Deploying your Infrastructure** screen appears. If you're deploying **on existing infrastructure**, select **Done**. This is your final step. Harness installs the chaos infrastructure on your behalf.

#### On New Infrastructure <a href="#on-new-infrastructure" id="on-new-infrastructure"></a>

1. If you're deploying on **new infrastructure**, provide a name for the new infrastructure, a **Description** (optional) and a **Tag** (optional). Select **Next**.
2. On the **Configure Chaos Infrastructure** screen, provide details like the installation type, access type, namespace, and service account name. Select **Next**.
3. Copy the given command(s), download the installation manifest YAML and run it on the terminal, based on cluster-wide or namespace access.
   * **For cluster-wide access:**
     1. Select **Download**, and then copy and run the `kubectl` command shown on your screen to install the chaos infrastructure. Select **Done**.

        ![Cluster Wide Setup Infrastructure](/files/a0IjL9nzOvv1cQx54ZWR)
   * **For namespace access:**
     1. Run the first `kubectl` command to create the target namespace.
     2. Run the second `kubectl` command to apply the chaos CRDs.
     3. Select **Download**, and then copy and run the third command to install the chaos infrastructure. Select **Done**.

        ![Namespace Mode Setup Infrastructure](/files/jreBcJ3bg9FZjZcY7JRg)

#### Use Helm Template to Install Chaos Infrastructure <a href="#use-helm-template-to-install-chaos-infrastructure" id="use-helm-template-to-install-chaos-infrastructure"></a>

Harness CE provides Helm support to install chaos infrastructure, in addition to installing with the help of a manifest (as explained earlier).

To use Helm to install a chaos infrastructure,

1. Navigate to **Chaos Experiments** -> **Environment**. Select **New environment** and create an environment and install or upgrade chaos infrastructure. To enable chaos in an existing environment, click the environment.

   ![step 2](/files/axlAQ3fSCLiuABGSpSRk)
2. Click **Enable chaos**.

   ![step 3](/files/DPyhAN6lSI9e0njcOAry)
3. You can use Helm commands to enable chaos on new infrastructure only. Click **On new infrastructures** and **Continue**. Add a name, description (optional), and a tag (optional). Click **Next**.

   ![step 4](/files/sT5Gt0phY9yPecoCZ7Kf)
4. Choose the installation type as **Helm**, and one of the access types (namespace or cluster-wide). Specify namespace and service account.

   ![step 6](/files/326cQZ8LvyaxzspUG6dM)
5. Depending on the type of access you choose, you will see a set of commands. If you select namespace type, you will need to enter some advanced input values. Click **Next**.

   ![step 7a](/files/JJyYkYZuYt5zwjwKTG9b)
6. You will see the following commands that you need to execute on your terminal. Once you are done, click **Completed Command Execution**.

   ![step 8](/files/r0vxEszv1reQHYRk9POU)
7. If you select the namespace scope, you will see some commands that you need to execute on your terminal. One you are done, click **Completed Command Execution**.

#### Upgrade Infrastructure <a href="#upgrade-infrastructure" id="upgrade-infrastructure"></a>

To upgrade Helm-based installation's infrastructure, go to [Upgrade Infrastructure](/resilience-testing/chaos-engineering/use-chaos-engineering/infrastructure/upgrade-infra.md#use-helm-template-to-upgrade-chaos-infrastructure).

### Validate Installation <a href="#validate-installation" id="validate-installation"></a>

After adding chaos infrastructure, Harness takes some time to set up all the chaos infrastructure resources. On the UI, if you navigate to **Environments** -> **Kubernetes**, you can see the connection status is `CONNECTED`.

![](/files/kbT8ZchDS1dg4DCSr8k2)

That's it! Now you have a dedicated Kubernetes chaos infrastructure and you're all set to inject chaos into your infrastructure.

### Disable Infrastructure <a href="#disable-infrastructure" id="disable-infrastructure"></a>

1. Select the `⋮` icon against the chaos infrastructure name and select **Disable**.

   ![Delete Chaos Infra](/files/YzjxBUSBhYXkJ2cF2MZW)
2. Execute the commands displayed in the modal from your terminal to remove the chaos infrastructure components. Finally, select **Confirm**.

This disables your Kubernetes infrastructure.

### Next Steps <a href="#next-steps" id="next-steps"></a>

* [Delegate-Driven Chaos Infrastructure](/resilience-testing/chaos-engineering/use-chaos-engineering/infrastructure/types/ddcr/ddcr.md)
* [Dedicated versus Delegate Driven Infrastructure](/resilience-testing/chaos-engineering/use-chaos-engineering/infrastructure/types/ddcr-vs-dedicated.md)
* [Upgrade Infrastructure](/resilience-testing/chaos-engineering/use-chaos-engineering/infrastructure/upgrade-infra.md)
