# Proxmox Deployment - Quick Start Guide

**Last Updated**: 2024-12-19

## Overview

This guide provides a quick path to deploy the Crossplane Proxmox provider and configure all components.

## Prerequisites

- Kubernetes cluster (kubectl configured)
- Go 1.21+ (for building provider)
- Cloudflare account (for DNS and tunnels)
- Proxmox API credentials
- Network access to Proxmox instances

## Quick Deployment

### Option 1: Automated Script (Recommended)

```bash
# Run the quick deployment script
./scripts/quick-deploy.sh
```

This interactive script guides you through all deployment steps.

### Option 2: Manual Step-by-Step

#### 1. Test Connectivity

```bash
# Test Proxmox connectivity
./scripts/test-proxmox-connectivity.sh

# With credentials
export PROXMOX_TOKEN='user@realm!token-id=token-secret'
./scripts/test-proxmox-connectivity.sh
```

#### 2. Configure DNS

```bash
# Set Cloudflare credentials
export CLOUDFLARE_ZONE_ID="your-zone-id"
export CLOUDFLARE_API_TOKEN="your-api-token"

# Create DNS records
./scripts/setup-dns-records.sh
```

#### 3. Deploy Provider

```bash
# Build and deploy Crossplane provider
./scripts/deploy-crossplane-provider.sh

# Or skip build if already built
BUILD_PROVIDER=false ./scripts/deploy-crossplane-provider.sh
```

#### 4. Create Credentials Secret

```bash
# Interactive secret creation
./scripts/create-proxmox-secret.sh
```

#### 5. Apply ProviderConfig

```bash
# Apply provider configuration
kubectl apply -f crossplane-provider-proxmox/examples/provider-config.yaml

# Verify
./scripts/verify-provider-deployment.sh
```

#### 6. Deploy Test VMs

```bash
# Deploy test VMs to both instances
./scripts/deploy-test-vms.sh
```

#### 7. Setup Monitoring

```bash
# Configure Prometheus and Grafana
./scripts/setup-monitoring.sh
```

## Verification

### Check Provider Status

```bash
# Verify provider is running
kubectl get pods -n crossplane-system

# Check provider logs
kubectl logs -n crossplane-system -l app=crossplane-provider-proxmox

# Verify ProviderConfig
kubectl get providerconfig proxmox-provider-config
```

### Check VM Status

```bash
# List all VMs
kubectl get proxmoxvm

# Get VM details
kubectl describe proxmoxvm <vm-name>

# Check VM status
kubectl get proxmoxvm <vm-name> -o yaml
```

### Test Connectivity

```bash
# Test Proxmox API access
curl -k -H "Authorization: PVEAPIToken <token>" \
  https://ml110-01.sankofa.nexus:8006/api2/json/version

curl -k -H "Authorization: PVEAPIToken <token>" \
  https://r630-01.sankofa.nexus:8006/api2/json/version
```

## Troubleshooting

### Provider Not Starting

```bash
# Check provider logs
kubectl logs -n crossplane-system -l app=crossplane-provider-proxmox

# Check CRDs
kubectl get crd | grep proxmox

# Verify ProviderConfig
kubectl describe providerconfig proxmox-provider-config
```

### VM Creation Failing

```bash
# Check VM resource status
kubectl describe proxmoxvm <vm-name>

# Check provider logs for errors
kubectl logs -n crossplane-system -l app=crossplane-provider-proxmox | grep -i error

# Verify credentials secret
kubectl get secret proxmox-credentials -n crossplane-system -o yaml
```

### DNS Not Resolving

```bash
# Test DNS resolution
dig ml110-01.sankofa.nexus
dig r630-01.sankofa.nexus

# Check /etc/hosts if using local resolution
cat /etc/hosts | grep sankofa.nexus
```

## Common Commands

```bash
# View all Proxmox resources
kubectl get proxmoxvm,proxmoxvmscaleset,providerconfig

# Delete a VM
kubectl delete proxmoxvm <vm-name>

# Update ProviderConfig
kubectl apply -f crossplane-provider-proxmox/examples/provider-config.yaml

# Restart provider
kubectl rollout restart deployment/crossplane-provider-proxmox -n crossplane-system
```

## Next Steps

1. **Deploy Production VMs**: Create VM manifests for production workloads
2. **Configure Monitoring**: Set up alerts and dashboards
3. **Set Up Backups**: Configure automated VM backups
4. **Security Hardening**: Review and implement security best practices

## Related Documentation

- [Deployment Checklist](./DEPLOYMENT_CHECKLIST.md)
- [Deployment Guide](./DEPLOYMENT_GUIDE.md)
- [Task List](./TASK_LIST.md)
- [DNS Configuration](./DNS_CONFIGURATION.md)

