Enable and disable infrastructure
This topic describes how you can enable and disable a Harness Delegate to use with chaos experiments.
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. Before creating an infrastructure, create an environment because a chaos infrastructure is created within an environment.
If you want to delete your environment, remove the environment references, that is, the infrastructure(s) associated with it first.
Enable Chaos
- Windows
- Helm template
On Windows
Ensure that you have fulfilled the prerequisites before connecting to a Windows chaos infrastructure.
-
Go to Environments and click Windows. click Enable chaos.
-
Add name (mandatory), and an admin user ("Administrator"). Select Next.
-
Copy the command generated. The prerequisites discusses how you can configure a password. If you have a password, replace it in the
<your-password>
placeholder. Execute this command on your terminal (remember to open the command prompt as an admin if you are not an admin by default). Click Done once you finish the execution.
This displays the following updates about the installation on your terminal.
Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/7/2024 7:48 AM HCE
Downloading Testlimit...
Extracting Testlimit...
Accepting Testlimit EULA...
Testlimit EULA accepted.
Downloading windows-chaos-infrastructure binary...
Config file created at C:\\HCE\config.yaml
Directory: C:\HCE\Logs
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/7/2024 7:51 AM 0 windows-chaos-infrastructure.log
[SC] CreateService SUCCESS
Service created and started successfully.
Use Helm Template to Install Chaos Infrastructure
HCE 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,
-
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.
-
Click Enable chaos.
-
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.
-
Choose the installation type as Helm, and one of the access types (namespace or cluster-wide). Specify namespace and service account.
-
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.
-
You will see the following commands that you need to execute on your terminal. Once you are done, click Completed Command Execution.
-
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.
Harness Terraform Provider
You can create Harness Delegate (DDCR) using Harness Terraform provider.
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.
- Kubernetes
- Linux
- Windows
Kubernetes
-
Select the
⋮
icon against the chaos infrastructure name and select Disable. -
Execute the commands displayed in the modal from your terminal to remove the chaos infrastructure components. Finally, select Confirm.
Linux
-
Select the
⋮
icon against the chaos infrastructure name and select Disable. -
Copy the command displayed in the modal, and execute it in your Linux machine to uninstall the chaos infrastructure components. Finally, select Confirm.
Windows
-
Select the
⋮
icon against the chaos infrastructure name and select Disable. -
Copy the command displayed in the modal, and execute it in your Windows machine terminal to uninstall the chaos infrastructure components. Finally, select Confirm.
With that, the chaos infrastructure will be disabled.