|
| 1 | +--- |
| 2 | +id: agent-install |
| 3 | +title: Litmus Chaos Agent Install |
| 4 | +sidebar_label: Chaos Agent |
| 5 | +--- |
| 6 | + |
| 7 | +In Litmus the Agents can be classified as two types |
| 8 | + |
| 9 | +- Self Agent |
| 10 | +- External Agent |
| 11 | + |
| 12 | +As part of Litmus installation by default, a self cluster would be registered as Agent in the Portal. From Portal you induce chaos into self cluster and observe the results from the Portal. |
| 13 | + |
| 14 | +As you are aware by now, Portal is a Cross Cloud Chaos Control plane. That is you can connect multiple external kubernetes agents to this portal. Once connected you can manage the chaos from the Portal that is you can induce chaos into this agent from the Portal and observe the results from the Portal. Using the command line utility _litmusctl_ you can connect the external agents to the Portal. |
| 15 | + |
| 16 | +# Litmusctl |
| 17 | + |
| 18 | +Litmusctl is a command line interface to manage LitmusPortal services. |
| 19 | + |
| 20 | +## Requirements |
| 21 | + |
| 22 | +The litmusctl CLI requires the following things: |
| 23 | + |
| 24 | +- Kubeconfig - litmusctl needs the kubeconfig of the k8s cluster where we need to connect litmus agents. The CLI currently uses the default path of kubeconfig i.e. `~/.kube/config`. |
| 25 | + |
| 26 | +## Installation |
| 27 | + |
| 28 | +To install the latest version of litmusctl follow the below steps: |
| 29 | + |
| 30 | +- Download the latest litmusctl(master) binary from: |
| 31 | + |
| 32 | +| Platforms | Download Link | |
| 33 | +| ------------------------------ | ------------------------------------------------------------------------------------------------------- | |
| 34 | +| litmusctl-darwin-386 (MacOS) | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-darwin-386-master.tar.gz) | |
| 35 | +| litmusctl-darwin-amd64 (MacOS) | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-darwin-amd64-master.tar.gz) | |
| 36 | +| litmusctl-linux-386 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-linux-386-master.tar.gz) | |
| 37 | +| litmusctl-linux-amd64 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-linux-amd64-master.tar.gz) | |
| 38 | +| litmusctl-linux-arm | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-linux-arm-master.tar.gz) | |
| 39 | +| litmusctl-linux-arm64 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-linux-arm64-master.tar.gz) | |
| 40 | +| litmusctl-windows-386 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-windows-386-master.tar.gz) | |
| 41 | +| litmusctl-windows-amd64 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-windows-amd64-master.tar.gz) | |
| 42 | +| litmusctl-windows-arm | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-windows-arm-master.tar.gz) | |
| 43 | + |
| 44 | +<br /> |
| 45 | + |
| 46 | +- Download the litmusctl(v0.2.0) binary from: |
| 47 | + |
| 48 | +| Platforms | Download Link | |
| 49 | +| ------------------------------ | ------------------------------------------------------------------------------------------------------- | |
| 50 | +| litmusctl-darwin-386 (MacOS) | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-darwin-386-v0.2.0.tar.gz) | |
| 51 | +| litmusctl-darwin-amd64 (MacOS) | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-darwin-amd64-v0.2.0.tar.gz) | |
| 52 | +| litmusctl-linux-386 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-linux-386-v0.2.0.tar.gz) | |
| 53 | +| litmusctl-linux-amd64 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-linux-amd64-v0.2.0.tar.gz) | |
| 54 | +| litmusctl-linux-arm | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-linux-arm-v0.2.0.tar.gz) | |
| 55 | +| litmusctl-linux-arm64 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-linux-arm64-v0.2.0.tar.gz) | |
| 56 | +| litmusctl-windows-386 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-windows-386-v0.2.0.tar.gz) | |
| 57 | +| litmusctl-windows-amd64 | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-windows-amd64-v0.2.0.tar.gz) | |
| 58 | +| litmusctl-windows-arm | [Click here](https://litmusctl-bucket.s3-eu-west-1.amazonaws.com/litmusctl-windows-arm-v0.2.0.tar.gz) | |
| 59 | + |
| 60 | +<br /> |
| 61 | + |
| 62 | +- Extract the binary |
| 63 | + |
| 64 | +```shell |
| 65 | +$ tar -zxvf litmusctl-<OS>-<ARCH>-<VERSION>.tar.gz |
| 66 | +``` |
| 67 | + |
| 68 | +- Provide necessary permissions |
| 69 | + |
| 70 | +```shell |
| 71 | +$ chmod +x litmusctl |
| 72 | +``` |
| 73 | + |
| 74 | +- Move the litmusctl binary to /usr/local/bin/litmusctl |
| 75 | + |
| 76 | +```shell |
| 77 | +$ sudo mv litmusctl /usr/local/bin/litmusctl |
| 78 | +``` |
| 79 | + |
| 80 | +## Basic Commands |
| 81 | + |
| 82 | +litmusctl CLI command has the following structure: |
| 83 | + |
| 84 | +```shell |
| 85 | +$ litmusctl <command> <subcommand> <subcommand> [options and parameters] |
| 86 | +``` |
| 87 | + |
| 88 | +To get the version of the litmusctl CLI: |
| 89 | + |
| 90 | +```shell |
| 91 | +$ litmusctl version |
| 92 | +``` |
| 93 | + |
| 94 | +### Connecting an agent |
| 95 | + |
| 96 | +To connect Litmus Chaos agent: |
| 97 | + |
| 98 | +```shell |
| 99 | +$ litmusctl agent connect |
| 100 | +``` |
| 101 | + |
| 102 | +Next, you need to enter LitmusPortal details to login into your LitmusPortal account. Fields to be filled in: |
| 103 | + |
| 104 | +**LitmusPortal UI URL:** Enter the URL used to access the Litmus Portal UI. |
| 105 | +Example, http://172.17.0.2:31696/ |
| 106 | + |
| 107 | +**Username:** Enter your LitmusPortal username. |
| 108 | +**Password:** Enter your LitmusPortal password. |
| 109 | + |
| 110 | +```shell |
| 111 | +🔥 Connecting LitmusChaos agent |
| 112 | + |
| 113 | +📶 Please enter LitmusChaos details -- |
| 114 | +👉 Host URL where litmus is installed: http://172.17.0.2:31696/ |
| 115 | +🤔 Username [admin]: admin |
| 116 | +🙈 Password: |
| 117 | +✅ Login Successful! |
| 118 | +``` |
| 119 | + |
| 120 | +Upon successful login, there will be a list of exiting projects displayed on the terminal. Select the desired project by entering the sequence number indicated against it. |
| 121 | + |
| 122 | +```shell |
| 123 | +✨ Projects List: |
| 124 | +1. abc |
| 125 | + |
| 126 | +🔎 Select Project: 1 |
| 127 | +``` |
| 128 | + |
| 129 | +Next, select the installation mode. In case the selected mode was a Cluster there will be a prerequisites check to verify ClusterRole and ClusterRoleBinding. |
| 130 | + |
| 131 | +```shell |
| 132 | +🔌 Installation Modes: |
| 133 | +1. Cluster |
| 134 | +2. Namespace |
| 135 | + |
| 136 | +👉 Select Mode [cluster]: 1 |
| 137 | + |
| 138 | +🏃 Running prerequisites check.... |
| 139 | +🔑 clusterrole - ✅ |
| 140 | +🔑 clusterrolebinding - ✅ |
| 141 | + |
| 142 | +🌟 Sufficient permissions. Connecting Agent |
| 143 | +``` |
| 144 | + |
| 145 | +Next, enter the details of the new agent. |
| 146 | + |
| 147 | +Fields to filled in: |
| 148 | +**Agent Name:** Enter the name for the new agent. |
| 149 | + |
| 150 | +**Agent Description:** Fill in details about the agent. |
| 151 | + |
| 152 | +**Platform Name:** Enter the platform name on which this agent is hosted. For example, AWS, GCP, Rancher etc. |
| 153 | + |
| 154 | +**Enter the namespace:** You can either enter an existing namespace or enter a new namespace. In cases where the namespace does not exist, LitmusPortal creates it for you. |
| 155 | + |
| 156 | +**Enter service account:** Enter a name for your service account. |
| 157 | + |
| 158 | +```shell |
| 159 | +🔗 Enter the details of the agent ---- |
| 160 | +🤷 Agent Name: my-agent |
| 161 | +📘 Agent Description: This is a new agent. |
| 162 | +📦 Platform List |
| 163 | +1. AWS |
| 164 | +2. GKE |
| 165 | +3. Openshift |
| 166 | +4. Rancher |
| 167 | +5. Others |
| 168 | +🔎 Select Platform [Others]: 5 |
| 169 | +📁 Enter the namespace (new or existing) [litmus]: litmus |
| 170 | +🔑 Enter service account [litmus]: litmus |
| 171 | +``` |
| 172 | + |
| 173 | +Once, all these steps are implemented you will be able to see a summary of all the entered fields. |
| 174 | +After verification of these details, you can proceed with the connection of the agent by entering Y. The process of connection might take up to a few seconds. |
| 175 | + |
| 176 | +```shell |
| 177 | +📌 Summary -------------------------- |
| 178 | + |
| 179 | +Agent Name: my-agent |
| 180 | +Agent Description: This is a new agent. |
| 181 | +Platform Name: Others |
| 182 | +Namespace: litmus |
| 183 | +Service Account: litmus |
| 184 | +Installation Mode: cluster |
| 185 | + |
| 186 | +------------------------------------- |
| 187 | + |
| 188 | +🤷 Do you want to continue with the above details? [Y/N]: Y |
| 189 | + |
| 190 | +💡 Connecting agent to Litmus Portal. |
| 191 | +🏃 Agents running!! |
| 192 | +🚀 Agent Connection Successful!! 🎉 |
| 193 | +👉 Litmus agents can be accessed here: http://172.17.0.2:31696/targets |
| 194 | +``` |
| 195 | + |
| 196 | +To verify, if the connection process was successful you can view the list of connected agents from the Targets section on your LitmusPortal and ensure that the connected agent is in Active State. |
0 commit comments