Skip to content

1. Deploying Kubernetes Using Terraform

Steven Platt edited this page Oct 9, 2021 · 3 revisions

Deploying a new cluster

Terraform is used to deploy cloud infrastructure for the Kubernetes cluster. To deploy teh Kubernetes cluster, Terraform must be installed to your local machine (source 1) (source 2).

  1. Install the terraform cli.

Terraform install instructions

  1. Clone the homelab repository.

git clone https://github.com/stevenplatt/homelab.git && cd homelab/terraform/

  1. Initialize Terraform within the repository directory.

terraform init

  1. Double-check the planned infrastructure changes.

terraform plan

  1. Assuming everything looks correct, launch the infrastructure deployment.

terraform deploy

Terraform will request the Digital Ocean API token (it must have read/write priveledges), and to confirm yes a final time to apply the change.

Note: Using terraform destroy from the same directory will delete the infrastructure that was launched using terraform deploy.

Clone this wiki locally