Kubernetes The Hard Way on DigitalOcean (Terraform)
This repository contains Terraform configuration files to quickly provision the necessary DigitalOcean Droplets to complete the Kubernetes The Hard Way tutorial.
This setup creates 4 Droplets:
- jump-box: jumphost
- server: Control plane node
- node-1, node-0*: Worker nodes
This configuration mirrors the official tutorial's requirements and lets you focus on Kubernetes component configuration.
- Terraform: Install Terraform on your local machine
- DigitalOcean Account & API Token: Generate a Personal Access Token with read/write permissions
- SSH Key Pair: Required for Droplet access
Create a terraform.tfvars file in the root directory:
dotoken = "YOUR_DO_API_TOKEN_HERE"
ssh_pub_key = "~/.ssh/k8s_hard_way_rsa.pub"| Variable | Description | Example |
|---|---|---|
dotoken |
DigitalOcean Personal Access Token | "xxxxxxxxxxxx..." |
ssh_pub_key |
Path to your public SSH key | "~/.ssh/id_rsa.pub" |
Run the following commands in your terminal to initialize the provider and provision the infrastructure:
terraform init
terraform apply -var-file="variables.tfvars" # Type 'yes' to confirmAfter provisioning, retrieve the Droplet IP addresses:
terraform outputOutputs include:
jump_box = "XXX.XXX.XXX.XXX"
node-0 = "XXX.XXX.XXX.XXX"
node-1 = "XXX.XXX.XXX.XXX"
server = "XXX.XXX.XXX.XXX"To destroy resources and avoid billing:
terraform destroy -var-file="variables.tfvars # Type 'yes' to confirmDisclaimer: This configuration is for educational purposes only with the Kubernetes The Hard Way tutorial. Do not use for production workloads.