--- id: usage-non-interactive-mode title: Installing ChaosAgents in non interactive mode sidebar_label: Using non interactive mode --- --- # Usage: Litmusctl v0.3.0 > Notes: > * For litmusctl v0.3.0 or latest > * Compatible with Litmus 2.0.0 or latest ### litmusctl Syntax `litmusctl` has a syntax to use as follows: ```shell litmusctl [command] [TYPE] [flags] ``` * Command: refers to what you do want to perform (create, get and config) * Type: refers to the feature type you are performing a command against (agent, project etc.) * Flags: It takes some additional information for resource operations. For example, `--installation-mode` allows you to specify an installation mode. Litmusctl is using the `.litmusconfig` config file to manage multiple accounts 1. If the --config flag is set, then only the given file is loaded. The flag may only be set once and no merging takes place. 2. Otherwise, the ${HOME}/.litmusconfig file is used, and no merging takes place. Litmusctl supports both interactive and non-interactive(flag based) modes. > Only `litmusctl create agent` command needs --non-interactive flag, other commands don't need this flag to be in non-interactive mode. If mandatory flags aren't passed, then litmusctl takes input in an interactive mode. ### Installation modes Litmusctl can install an agent in two different modes. * cluster mode: With this mode, the agent can run the chaos in any namespace. It installs appropriate cluster roles and cluster role bindings to achieve this mode. It can be enabled by passing a flag `--installation-mode=cluster` * namespace mode: With this mode, the agent can run the chaos in its namespace. It installs appropriate roles and role bindings to achieve this mode. It can be enabled by passing a flag `--installation-mode=namespace` Note: With namespace mode, the user needs to create the namespace to install the agent as a prerequisite. ### Minimal steps to create an agent * To setup an account with litmusctl ```shell litmusctl config set-account --endpoint="" --username="" --password="" ``` * To create an agent without a project in a cluster mode >Note: If the user doesn't have any project, it will create a random project and add the agent in that random project. ```shell litmusctl create agent --agent-name="" --non-interactive ``` Or, * To create an agent with an existing project > Note: To get `project-id`. Apply `litmusctl get projects` ```shell litmusctl create agent --agent-name="" --project-id="" --non-interactive ``` #### Verify the new Agent Connection To verify, if the connection process was successful you can view the list of connected agents from the Targets section on your ChaosCenter and ensure that the connected agent is in Active State. ### Flags for `create agent` command
| Flag | Short Flag | Type | Description |
|---|---|---|---|
| --agent-description | String | Set the agent description (default "---") | |
| --agent-name | String | Set the cluster-type to external for external agents | Supported=external/internal (default "external") | |
| --cluster-type | String | Set the cluster-type to external for external agents | Supported=external/internal (default "external") | |
| --installation-mode | String | Set the installation mode for the kind of agent | Supported=cluster/namespace (default "cluster") | |
| --kubeconfig | -k | String | Set to pass kubeconfig file if it is not in the default location ($HOME/.kube/config) |
| --namespace | String | Set the namespace for the agent installation (default "litmus") | |
| --node-selector | String | Set the node-selector for agent components | Format: key1=value1,key2=value2) | |
| --non-interactive | -n | String | Set it to true for non interactive mode | Note: Always set the boolean flag as --non-interactive=Boolean |
| --ns-exists | Boolean | Set the --ns-exists=false if the namespace mentioned in the --namespace flag is not existed else set it to --ns-exists=true | Note: Always set the boolean flag as --ns-exists=Boolean | |
| --platform-name | String | Set the platform name. Supported- AWS/GKE/Openshift/Rancher/Others (default "Others") | |
| --sa-exists | Boolean | Set the --sa-exists=false if the service-account mentioned in the --service-account flag is not existed else set it to --sa-exists=true | Note: Always set the boolean flag as --sa-exists=Boolean" | |
| --service-account | String | Set the service account to be used by the agent (default "litmus") | |
| --config | String | config file (default is $HOME/.litmusctl) |