Automate Deployment for Production
You can deploy Redpanda for production on bare metal with the Redpanda installation binary.
If you use automation tools in your environment, like Terraform and Ansible, you can use those tools for your Redpanda production deployment.
Set up infrastructure with Terraform
-
Install Terraform. See the Terraform documentation.
-
To clone the
deployment-automationrepo:git clone https://github.com/redpanda-data/deployment-automation.git -
To change into the directory:
cd deployment-automation -
Follow the specific instructions for AWS or GCP:
-
AWS
-
GCP
-
Within the
deployment-automationfolder, change into theawsdirectory:cd aws -
Set AWS credentials. Terraform provides multiple ways to set the AWS secret and key. See the Terraform documentation.
-
To initialize Terraform:
terraform init -
To create the cluster:
terraform applyConfiguration options:
Property Description aws_regionThe AWS region to use for deploying the infrastructure. Default:
us-west-2nodesThe number of nodes to base the cluster on. Default:
3enable_monitoringCreates a Prometheus/Grafana instance for monitoring the cluster. Default:
trueinstance_typeThe instance type on which Redpanda is deployed. Default:
i3.8xlargeprometheus_instance_typeThe instance type on which Prometheus and Grafana are deployed. Default:
c5.2xlargepublic_key_pathPath to the public key of the keypair used to access the nodes. Default:
~/.ssh/id_rsa.pubdistroLinux distribution to install. (This affects the
distro_variables.) Default:ubuntu-focaldistro_amiAWS AMI to use for each available distribution. These must be changed according to the chosen AWS region.
distro_ssh_userUser used to ssh into the created EC2 instances.
The following example creates a three-node cluster using i3.large instances.
terraform apply -var="instance_type=i3.large"
-
Within the
deployment-automationfolder, change into thegcpdirectory:cd gcp -
You need an existing subnet to deploy the VMs into. The subnet’s attached firewall should allow inbound traffic on ports 22, 3000, 8082, 8888, 8889, 9090, 9092, 9644, and 33145. This module adds the
rp-nodetag to the deployed VMs, which can be used as the target tag for the firewall rule. -
To initialize Terraform:
terraform init -
To create the cluster:
terraform applyConfiguration options:
Property Description regionThe region to use for deploying the infrastructure. Default:
us-west1zoneThe region’s zone to deploy the infrastructure. Default:
asubnetThe name of an existing subnet to deploy the infrastructure.
nodesThe number of nodes to base the cluster on. Keep in mind that one node is used as a monitoring node. Default:
1disksThe number of local disks to deploy on each machine. Default =
1imageThe OS image running on the VMs. Default:
ubuntu-os-cloud/ubuntu-1804-ltsmachine_typeThe machine type. Default:
n2-standard-2public_key_pathPath to the public key of the keypair used to access the nodes.
ssh_userThe ssh user. Must match the one in the public ssh key’s comments.
The following example creates a three-node cluster using the subnet named
redpanda-cluster-subnet.terraform apply -var nodes=3 -var subnet=redpanda-cluster-subnet -var public_key_path=~/.ssh/id_rsa.pub -var ssh_user=$USER
-
Next steps
Now you can install Redpanda either with the Redpanda installation binary or with Ansible.
Install Redpanda with Ansible
Whether you are using bare metal servers or Terraform, you can use Ansible to install Redpanda.
Prerequisites
Install Ansible. See the Ansible documentation.
Clone the GitHub repository
To clone the repo:
git clone git@github.com:redpanda-data/deployment-automation.git
To change into the directory:
cd deployment-automation
To install the required roles needed by Ansible:
ansible-galaxy install -r ansible/requirements.yml
Configure the hosts.ini file
The hosts.ini file is in the deployment-automation directory. If you used Terraform to deploy the instances, this file is updated automatically. If you did not use Terraform, you must update it
manually. When you open the file, and you see something like the following:
[redpanda]
ip ansible_user=ssh_user ansible_become=True private_ip=pip id=0
ip ansible_user=ssh_user ansible_become=True private_ip=pip id=1
[monitor]
ip ansible_user=ssh_user ansible_become=True private_ip=pip id=1
Under the [redpanda] section, replace the following:
| Property | Description |
|---|---|
|
The public IP address of the machine. |
|
The username for Ansible to use to ssh to the machine. |
|
The private IP address of the machine. This could be the same as the public IP address. |
|
The node ID of the Redpanda instance. This must be unique for each host. |
The [monitor] section is only relevant if you have Prometheus and Grafana installed
on a given host. If you don’t want to have this deployed, then remove the
[monitor] section.