Skip to main content

Connect chaos infrastructures

Chaos infrastructure is a service that runs in your target environment and aids Harness Chaos Engineering (HCE) in accessing and injecting chaos at cloud-native scale. There are different types of chaos infrastructure based on the target environments, such as Kubernetes, Linux VMs, etc. These chaos infrastructures can be installed as a Kubernetes service, as a Linux daemon, and so on, based on their type.

All the chaos infrastructure services adhere to the principle of least privilege, where the services execute with the minimum number of required permissions.

Step 1. Create an environment

You must create a new environment in Harness to specify where you want the chaos infrastructure to exist.

To create an environment:

  1. In your Harness project, navigate to Chaos > Environments.

  2. Select + New Environment.

  3. In the Create a new environment screen, specify a Name for the environment, and optionally a Description and a Tag.

  4. For Environment type, choose either Production or Non-Production, and then click Create.

This creates a new environment.

New Environment

Step 2. Add a chaos infrastructure

This section outlines the steps to add a chaos infrastructure to a Kubernetes environment.

You can either setup a chaos infrastructure on existing infrastructures that uses a Harness cluster connector, that is, Harness Kubernetes connector or install the chaos infrastructure on a new infrastructure.

To add a chaos infrastructure on an existing Harness Kubernetes connector:

  1. In Harness, navigate to Chaos > Environments, and then select the environment you want to add chaos infrastructure to.

  2. In the environment details page, select + Enable Chaos.

  3. On the next screen, select where to add chaos infrastructure, and then select Continue.

Select one of the following:

  • On Existing Infrastructures
  • On New Infrastructures
  1. If you selected On Existing Infrastructures, on the next screen, select any connector under the Project, Organization, or Account scope. (Otherwise skip this step.)

    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. Select Continue.

  2. On the next screen, enter a Name for the chaos infrastructure, and optional Description and Tags, and then select Next.

The Configure Chaos Infrastructure screen appears.

Configure Chaos Infrastructure

  1. 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 the installation will take place in the hce namespace and uses hce service account, which can be configured under the K8s cluster details.

    Optionally, you can also specify the node selectors and Kubernetes tolerations 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.
  2. Select Next.

The Deploying your Infrastructure screen appears.

  1. If you're deploying on existing infrastructure, select Done.

This is your final step. Harness installs the chaos infrastructure on your behalf.

Step 3. Validate the chaos infrastructure installation

After the final step of 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're all set to inject chaos into your infrastructure.