# Deployment Guide ## Prerequisites Before starting the deployment, ensure you have: 1. **Two Proxmox VE hosts** with: - Proxmox VE 7.0+ installed - Static IP addresses configured - At least 8GB RAM per node - Network connectivity between nodes - Root or sudo access 2. **Azure Subscription** with: - Azure CLI installed and authenticated - Contributor role on subscription - Resource group creation permissions 3. **Network Requirements**: - Static IP addresses for all nodes - DNS resolution (or hosts file) - Internet access for Azure Arc connectivity - NFS server (optional, for shared storage) 4. **Tools Installed**: - SSH client - kubectl - helm (optional) - terraform (optional) 5. **Environment Configuration**: - Copy `.env.example` to `.env` and fill in all credentials - See [Configuration](#configuration) section for details ## Configuration ### Environment Variables Setup Before starting deployment, configure your environment variables: 1. **Copy the template:** ```bash cp .env.example .env ``` 2. **Edit `.env` with your credentials:** - Azure credentials: `AZURE_SUBSCRIPTION_ID`, `AZURE_TENANT_ID` - Cloudflare: `CLOUDFLARE_API_TOKEN` - Proxmox: `PVE_ROOT_PASS` (shared root password for all instances) - Proxmox ML110: `PROXMOX_ML110_URL` - Proxmox R630: `PROXMOX_R630_URL` **Note**: The username `root@pam` is implied and should not be stored. For production operations, use RBAC accounts and API tokens instead of root credentials. 3. **Load environment variables:** ```bash # Source the .env file export $(cat .env | grep -v '^#' | xargs) ``` **Note**: All scripts in this guide will use environment variables from `.env` if available. You can also set them manually using `export` commands. ## Deployment Phases ### Phase 1: Proxmox Cluster Setup #### Step 1.1: Configure Network on Both Nodes On each Proxmox node: ```bash # Option 1: Use .env file (recommended) # Load environment variables from .env export $(cat .env | grep -v '^#' | xargs) # Option 2: Set environment variables manually export NODE_IP=192.168.1.10 # Use appropriate IP for each node export NODE_GATEWAY=192.168.1.1 export NODE_NETMASK=24 export NODE_HOSTNAME=pve-node-1 # Use appropriate hostname # Run network configuration script cd /path/to/loc_az_hci ./infrastructure/proxmox/network-config.sh ``` **For Node 2**, repeat with appropriate values: ```bash export NODE_IP=192.168.1.11 export NODE_HOSTNAME=pve-node-2 ./infrastructure/proxmox/network-config.sh ``` #### Step 1.2: Update Proxmox Repositories On both nodes: ```bash # Update to subscription-free repos sed -i 's/enterprise/no-subscription/g' /etc/apt/sources.list.d/pve-enterprise.list apt update && apt dist-upgrade -y ``` #### Step 1.3: Configure Shared Storage (NFS) **Option A: Using existing NFS server** On both Proxmox nodes: ```bash export NFS_SERVER=192.168.1.100 export NFS_PATH=/mnt/proxmox-storage export STORAGE_NAME=nfs-shared ./infrastructure/proxmox/nfs-storage.sh ``` **Option B: Set up NFS server** If you need to set up an NFS server, install and configure it on a separate machine or VM. #### Step 1.4: Create Proxmox Cluster **On Node 1** (cluster creator): ```bash export NODE_ROLE=create export CLUSTER_NAME=hc-cluster ./infrastructure/proxmox/cluster-setup.sh ``` **On Node 2** (join cluster): ```bash export NODE_ROLE=join export CLUSTER_NODE_IP=192.168.1.10 # IP of Node 1 export ROOT_PASSWORD=your-root-password # Optional, will prompt if not set ./infrastructure/proxmox/cluster-setup.sh ``` **Verify cluster**: ```bash pvecm status pvecm nodes ``` ### Phase 2: Azure Arc Integration #### Step 2.1: Prepare Azure Environment ```bash # Load environment variables from .env (if using .env file) export $(cat .env | grep -v '^#' | xargs) # Login to Azure az login # Set subscription (use from .env or set manually) az account set --subscription "${AZURE_SUBSCRIPTION_ID:-your-subscription-id}" # Create resource group (if not exists) az group create --name "${AZURE_RESOURCE_GROUP:-HC-Stack}" --location "${AZURE_LOCATION:-eastus}" ``` #### Step 2.2: Onboard Proxmox Hosts to Azure Arc On each Proxmox node: ```bash # Load environment variables from .env (if using .env file) export $(cat .env | grep -v '^#' | xargs) # Set Azure variables (use from .env or get from Azure CLI) export RESOURCE_GROUP="${AZURE_RESOURCE_GROUP:-HC-Stack}" export TENANT_ID="${AZURE_TENANT_ID:-$(az account show --query tenantId -o tsv)}" export SUBSCRIPTION_ID="${AZURE_SUBSCRIPTION_ID:-$(az account show --query id -o tsv)}" export LOCATION="${AZURE_LOCATION:-eastus}" export TAGS="type=proxmox,environment=hybrid" ./scripts/azure-arc/onboard-proxmox-hosts.sh ``` **Verify in Azure Portal**: - Navigate to: Azure Portal → Azure Arc → Servers - You should see both Proxmox nodes #### Step 2.3: Create VMs for Kubernetes and Git Create VMs in Proxmox web UI or using Terraform: ```bash # Load environment variables from .env export $(cat .env | grep -v '^#' | xargs) cd terraform/proxmox # Create terraform.tfvars from environment variables or edit manually cat > terraform.tfvars <` 4. **GitOps not syncing**: - Check Flux logs: `kubectl logs -n flux-system -l app=flux` - Verify repository access - Check GitOps configuration in Azure Portal ## Next Steps 1. Review architecture documentation 2. Set up monitoring and alerting 3. Configure backup and disaster recovery 4. Implement security policies 5. Plan for scaling and expansion