Terraform
Increase number of replica instances
This topic describes how to increase the number of replica instances of your Terraform Enterprise deployment on Kubernetes so that your deployment can scale to meet demand.
Introduction
To handle increased computational workload requirements of your organization, you can scale Terraform Enterprise horizontally by increasing the number of terraform-enterprise
pods and terraform-enterprise agent
pods. Refer to the Scale Terraform Enterprise instances on Kubernetes overview for additional information.
Requirements
The requirements for your Kubernetes cluster depend on the specific workloads. Update CPU, RAM, storage, and network capacity according to your applications demands.
CPU requirements
The following minimum requirements for a Terraform Enterprise pod are appropriate for most initial production deployments and for development and test environments:
CPU | Memory |
---|---|
2 core | 3 GB RAM |
We tested with a minimum memory of 2.5GB and 0.75 vCPU and scaled up to maximum of 7.5GB and 4 vCPU.
resources:
requests:
memory: "2500Mi"
cpu: "750m"
limits:
memory: "7500Mi"
cpu: "4000m"
Database requirements
The following table describes the recommended minimum memory and CPU requirements for the PostgreSQL database. You may require additional resources depending on the anticipated demands on Terraform Enterprise within your organization:
Type | CPU | Memory | Storage |
---|---|---|---|
Minimum | 4 core | 16 GB RAM | 50 GB |
Scaling | 8 core | 32 GB RAM | 50 GB |
Redis cache requirements
We successfully tested Terraform Enterprise with the following data store configuration:
- 6GB Redis cache.
- Multi-AZ enabled.
- Automated failover enabled.
Increase terraform-enterprise
pods
Kubernetes creates a Deployment
object that manages the terraform-enterprise
pods through a ReplicaSet
. Refer to the Kubernetes documentation to learn about Deployment
s and ReplicaSet
s.
The deployment.yaml
file generated during the Terraform Enterprise deployment process includes the replicas
field, which determines how many terraform-enterprise
pods Kubernetes should create.
apiVersion: apps/v1
kind: Deployment
metadata:
name: terraform-enterprise
labels:
app: terraform-enterprise
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: terraform-enterprise
template:
metadata:
annotations:
{{- if .Values.pod.annotations }}
{{ toYaml .Values.pod.annotations | indent 8 }}
{{ end }}
labels:
app: terraform-enterprise
Complete the following steps to increase the number of terraform-enterprise
pods for your deployment:
- Update the value of
replicaCount
in the values file of your Helm chart. ThereplicaCount
value maps to thespec.replicas
value in the deployment file. The maximum number ofterraform-enterprise
pods you can instruct Kuberneteds to create is5
. - Run the
helm upgrade
command to update the deployment.
In the following example, the replicaCount
is set to 3
, which sets the spec.replicas
value to 3
after running helm ugrade
:
replicaCount: 3
...