Terraform for setting up my home-lab Kubernetes cluster.
-
Setup your workstation.
-
Install Ubuntu Server 22.04 LTS on the target server.
- Connect to WiFi or Ethernet.
- Enable OpenSSH.
-
Assign the target server a static IP address.
-
Copy your workstation's SSH key to the target server using
ssh-copy-id
. -
Create a
terrform.tfvars
file in./terraform/stage0
.
host = "{ip-address}"
user = "{user}"
password = "{password}"
- Create a
terrform.tfvars
file in./terraform/stage1
.
aws_region = "{your-aws-region}"
aws_access_key_id = "{your-aws-access-key-id}"
aws_secret_access_key = "{your-aws-secret-key"
- Create a
terrform.tfvars
file in./terraform/stage2
.
domain = "{your-domain}"
dhcp_server = "{your-dhcp_ip-address}"
dhcp_cidr = "{your-dhcp-cidr-block}"
pihole_admin_password = "{pihole-admin-password}"
pihole_timezone = "{your-timezone}
pihole_custom_dns_records = [
"{ip-address} {subdomain}"
]
operator_email_address = "{your-email-address}"
grafana_admin_password = "{grafana-admin-password}"
- Apply the Terraform.
cd ./terraform/stage0
terraform init
terraform apply
cd ../stage1
terraform init
terraform apply
cd ../stage2
terraform init
terraform apply
-
Change the DNS server in your router's DHCP settings to be the IP address of the target server.
-
Get the ArgoCD initial admin password.
kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 -d
kubectl delete secret argocd-initial-admin-secret -n argocd
- Check web apps running in Kubernetes.
- https://pihole.{your-domain}/admin
- Use the admin password specified in the stage 2 variables.
- https://argocd.{your-domain}
- Use "admin" and the initial admin password from step 9.
- Navigate to https://argocd.{your-domain}/user-info?changePassword=true and change the admin password.
- https://grafana.{your-domain}
- Use "admin" as the username and the grafana admin password you specified in the stage 2 variables.
- https://pihole.{your-domain}/admin