You are viewing documentation for a legacy Rasa product. If you want to get started building assistants with Rasa please check out our latest [documentation here](/content/docs/index.html).

This page contains detailed instructions for bootstrapping a Google GKE Cluster (K8S) via Terraform.

## Installation

We use Terraform and the [offical Gruntwork Terraform GKE Module](https://github.com/gruntwork-io/terraform-google-gke.git) Please visit the pages for a more detail on the setup.

### Set Up and Initialize your Terraform Workspace

Clone the Gruntwork GKE module Repository:

```bash
git clone https://github.com/gruntwork-io/terraform-google-gke
```

Switch into the repository directory:

```bash
cd terraform-google-gke
```

### Configure Terraform GKE Cluster

For educational reasons, we will not use the Helm resource in this step. Please uncomment the following lines in main.tf:

```hcl
#resource "helm_release" "nginx" {
# depends_on = [google_container_node_pool.node_pool]
# repository = "https://charts.bitnami.com/bitnami"
# name = "nginx"
# chart = "nginx"
#}
```

Fill in the required variables in variables.tf based on your needs as example:

```hcl
variable "project" {
description = "The project ID where all resources will be launched."
type = string
default = "<YOUR-COMPANY-PROJECT-ID>"
}

variable "location" {
description = "The location (region or zone) of the GKE cluster."
type = string
default = "europe-west1"
}

variable "region" {
description = "The region for the network. If the cluster is regional, this must be the same region. Otherwise, it should be the region of the zone."
type = string
default = "europe-west1"
}

variable "cluster_name" {
description = "The name of the Kubernetes cluster."
type = string
default = "rasa-x-test-cluster"
}

variable "cluster_service_account_name" {
description = "The name of the custom service account used for the GKE cluster. This parameter is limited to a maximum of 28 characters."
type = string
default = "rasa-x-test-cluster-sa"
}
```

### Authenticate to GCP

```bash
gcloud auth login
gcloud auth application-default login
```

##### note

`gcloud auth application-default` manages your active Application Default Credentials which provide a method to get credentials used in calling Google APIs. Visit [Google Cloud SDK documentation](https://cloud.google.com/sdk/gcloud/reference/auth/application-default) to learn more.

### Initialize Terraform

Initialize your Terraform workspace, which will download and configure the providers.

```bash
terraform init
```

### Plan Terraform Run

Check your Terraform plan before applying it with

```bash
terraform plan
```

If all is correct you will get a rendered execution plan.

### Run Terraform to Create a GKE Cluster

```bash
terraform apply
```

At the end of the `terraform apply`, you should now have a working GKE cluster and kubectl context configured. So let's verify that in the next step!

### Deploying NGINX Ingress Controller

We use NGINX Ingress Controller and need to deploy it via helm. Run the following commands:

```bash
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm -n ingress-nginx install ingress-nginx ingress-nginx/ingress-nginx --create-namespace
```

After some minutes you should see the Public LoadBalancer IP of the Ingress via:

```bash
kubectl -n ingress-nginx get svc ingress-nginx-controller
```

Example output shows a service with an external IP address that can be used to access the cluster.

### Next Steps

- [Setup Rasa X via Helm chart](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/installation-and-setup/install/helm-chart-installation/installation) on the fresh created GKE Cluster.
