---
title: "Terraform"
slug: "terraform"
updated: 2024-06-12T03:50:32Z
published: 2023-05-24T09:25:32Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://traceabledocs.document360.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Terraform

The topic explains how to use Terraform to install the Traceable platform agent in a Kubernetes environment. Make sure that Terraform is already installed before proceeding with installing Traceable Platform agent. For more information on installing Terraform, see [Download Terraform](https://www.terraform.io/downloads.html).

## Before you begin

Keep the Traceable agent token handy. Navigate to [Traceable's platform](https://app.traceable.ai/) and navigate to **Settings (![image-1638268402925](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/image-1638268402925.png))** > **Account** > **Access Tokens > Agent Token**. Copy and save the token. It would be required in the Traceable agent installation process.

## Download

Enter the following command to download the latest Terraform tarball:

```actionscript
curl -O https://downloads.traceable.ai/install/traceable-agent/terraform/kubernetes/latest/traceable-agent-tf-k8s.tar.gz
```

## Installation

Complete the following steps to install `traceable-agent`. Make sure

1. Create `traceableai`namespace by entering the following command:ActionScriptActionScript 

```actionscript
kubectl create namespace traceableai
```
2. Untar the Terraform archive that you downloaded earlier. Enter the following command:ActionScriptActionScript 

```actionscript
tar xvzf traceable-agent-tf-k8s.tar.gz
```
3. Change the directory.ActionScriptActionScript 

```actionscript
cd traceable-agent-tf-k8s/
```
4. Initialize the module by entering the following command:ActionScriptActionScript 

```actionscript
terraform init
```
5. Review the setup that will be installed by entering the following command. Add the agent token that you downloaded earlier.ActionScriptActionScript

```actionscript
terraform plan -var='token='
```
6. Apply the module by entering the following command:ActionScriptActionScript

```actionscript
terraform apply -var='token='
```

Note:Terraform creates a `terrafrom.tfstate` file. The file stores the current state of the infrastructure. It is recommended to keep track of this file.

### Load balance Platform agent

In a deployment where you have deployed more than one Traceable Platform agent, and you expect high span load, you load balance the spans among the Platform agents. Load balancing is available in Platform agent 1.26.0 and later and only applies to the Go agent. In Helm chart, add the following value:

`service_type:Headless`

## Verify the installation

Enter the following command to verify a successful installation of`&nbsp;traceable-agent:`

```actionscript
kubectl get pods -n traceableai
```

For example,

```actionscript
NAME                                     READY   STATUS    RESTARTS   AGE
traceable-agent-d8ff7cd79-qn2wb          1/1     Running   0          34m
```
