Skip to main content

Enable and disable infrastructure

This topic describes how you can enable and disable a chaos infrastructure.

Before you begin, review the following

Install Infrastructure

You can install chaos infrastructure as a Kubernetes service, as a Linux daemon, or as a Windows agent, based on the targets. A chaos infrastructure is created within an environment.

Create Environment

  1. In your Harness project, navigate to Chaos > Environments. Select + New Environment. In the Create a new environment screen, specify a Name for the environment, and optionally a Description and a Tag. For Environment type, choose either Production or Non-Production, and then click Create.

tip

If you want to delete your environment, remove the environment references, that is, the infrastructure(s) associated with it first.

Enable Chaos

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

tip

You can choose between Kubernetes and Kubernetes (Harness infrastructure). The former is a dedicated infrastructure whereas the latter uses Harness Delegate.

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.

  1. 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

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.
  1. 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.

tip
  • There can only be one cluster-wide chaos infrastructure per cluster.
  • There may be multiple namespace-scoped chaos infrastructures per cluster.

Configure Chaos Infrastructure

  1. 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.

Validate Chaos Infrastructure Installation

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

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

Disable Chaos Infrastructure

Disabling a chaos infrastructure removes it from the environment where it resides. It also removes the infrastructure services from the Kubernetes cluster.

Go to the Environments under the Chaos tab, that lists all the environments created under the current project. Select the environment that has the chaos infrastructure to be deleted.

Based on the infrastructure you have used, you can follow the steps to disconnect Kubernetes, Linux, and Windows infrastructure, respectively.

select to disconnect

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

    Delete Chaos Infra

  2. Execute the commands displayed in the modal from your terminal to remove the chaos infrastructure components. Finally, select Confirm.

With that, the chaos infrastructure will be disabled.