infra/clusters/vntx/QUICKSTART.md
2025-09-06 10:55:13 -05:00

2 KiB

Quick Start: Deploy K3s on Proxmox

1. Prerequisites

# Install OpenTofu (or use Terraform)
brew install opentofu

# Install Ansible
pip install ansible

# Get your SSH public key
cat ~/.ssh/id_rsa.pub

2. Configure for Your Environment

cd clusters/vntx/terraform

# Edit terraform.tfvars
vim terraform.tfvars

Important settings to update:

  • proxmox_nodes - Set to your actual Proxmox node names (check in Proxmox UI)
  • ssh_public_key - Replace with your actual SSH public key
  • control_plane_ips and worker_ips - Adjust for your network
  • proxmox_storage - Set to your storage name (usually "local-lvm" or "local")

3. Deploy Everything

cd ../

# Set Proxmox password
export TF_VAR_proxmox_password="your-proxmox-root-password"

# Run the deployment script
./deploy.sh

The script will:

  1. Create 5 Flatcar Linux VMs on Proxmox
  2. Install K3s cluster
  3. Configure kubectl access
  4. Optionally install MetalLB and Longhorn

4. Manual Steps (if not using deploy.sh)

# Step 1: Deploy VMs
cd terraform
tofu init
tofu plan
tofu apply

# Step 2: Wait for VMs to boot (60 seconds)

# Step 3: Install K3s
cd ../ansible
ansible-playbook -i inventory.yml prepare-flatcar.yml
ansible-playbook -i inventory.yml k3s-install.yml

# Step 4: Get kubeconfig
export KUBECONFIG=./kubeconfig
kubectl get nodes

5. Access Your Cluster

# Set kubeconfig
export KUBECONFIG=~/.kube/config-vntx

# Check nodes
kubectl get nodes

# Deploy a test service
kubectl create deployment nginx --image=nginx
kubectl expose deployment nginx --port=80 --type=LoadBalancer

Troubleshooting

If VMs don't start:

  • Check Proxmox has enough resources
  • Verify network bridge name in terraform.tfvars
  • Check Proxmox storage has space

If Ansible fails:

  • Ensure VMs are accessible: ping 10.0.0.101
  • Check SSH key is correct
  • Wait longer for VMs to fully boot

If K3s installation fails:

  • SSH to node: ssh core@10.0.0.101
  • Check logs: sudo journalctl -u k3s -f