Skip to content

Terraform for setting up my home-lab Kubernetes cluster.

Notifications You must be signed in to change notification settings

yarsiemanym/home-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 

Repository files navigation

Home Server

Terraform for setting up my home-lab Kubernetes cluster.

Setup

  1. Setup your workstation.

    1. Install Terraform.
    2. Install kubectl.
    3. Install Helm.
  2. Install Ubuntu Server 22.04 LTS on the target server.

    1. Connect to WiFi or Ethernet.
    2. Enable OpenSSH.
  3. Assign the target server a static IP address.

  4. Copy your workstation's SSH key to the target server using ssh-copy-id.

  5. Create a terrform.tfvars file in ./terraform/stage0.

host     = "{ip-address}"
user     = "{user}"
password = "{password}"
  1. 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"
  1. 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}"
  1. Apply the Terraform.
cd ./terraform/stage0
terraform init
terraform apply
cd ../stage1
terraform init
terraform apply
cd ../stage2
terraform init
terraform apply
  1. Change the DNS server in your router's DHCP settings to be the IP address of the target server.

  2. 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
  1. Check web apps running in Kubernetes.
    1. https://pihole.{your-domain}/admin
      1. Use the admin password specified in the stage 2 variables.
    2. https://argocd.{your-domain}
      1. Use "admin" and the initial admin password from step 9.
      2. Navigate to https://argocd.{your-domain}/user-info?changePassword=true and change the admin password.
    3. https://grafana.{your-domain}
      1. Use "admin" as the username and the grafana admin password you specified in the stage 2 variables.

Links