# VM Deployment Checklist

## Pre-Deployment Checklist

### 1. Configuration Validation

- [ ] Run validation script
  ```bash
  ./scripts/validate-and-optimize-vms.sh
  ```
- [ ] Fix any errors reported
- [ ] Review warnings (may be acceptable)

### 2. Quota Verification

- [ ] Check tenant quota (if applicable)
  ```bash
  ./scripts/pre-deployment-quota-check.sh <vm-file>
  ```
- [ ] Verify Proxmox resources
  ```bash
  ./scripts/check-proxmox-quota-ssh.sh
  ```
- [ ] Ensure sufficient resources available

### 3. Image Verification

- [ ] Verify image exists on Proxmox storage
- [ ] Confirm image name matches specification
- [ ] Check image is accessible on target node

### 4. Network Configuration

- [ ] Verify network bridge exists
- [ ] Check IP address availability
- [ ] Confirm DNS configuration

### 5. Storage Verification

- [ ] Verify storage pool exists
- [ ] Check storage pool has sufficient space
- [ ] Confirm storage pool supports VM disks

## Deployment Steps

### Step 1: Validate
```bash
./scripts/validate-and-optimize-vms.sh examples/production/phoenix/dns-primary.yaml
```

### Step 2: Check Quota
```bash
./scripts/pre-deployment-quota-check.sh examples/production/phoenix/dns-primary.yaml
```

### Step 3: Deploy
```bash
kubectl apply -f examples/production/phoenix/dns-primary.yaml
```

### Step 4: Monitor
```bash
kubectl get proxmoxvm -w
kubectl describe proxmoxvm phoenix-dns-primary
```

### Step 5: Verify
```bash
# Check VM status
kubectl get proxmoxvm phoenix-dns-primary

# Check VM details
kubectl describe proxmoxvm phoenix-dns-primary

# Check controller logs
kubectl logs -n crossplane-system -l app=crossplane-provider-proxmox --tail=50
```

## Post-Deployment Verification

### VM Status
- [ ] VM is in "running" state
- [ ] VM has assigned IP address
- [ ] QEMU guest agent is active

### Service Verification
- [ ] Required services are running
- [ ] Packages are installed
- [ ] Configuration is correct

### Connectivity
- [ ] SSH access works
- [ ] Network connectivity verified
- [ ] DNS resolution works (if applicable)

## Troubleshooting

### Quota Check Fails
1. Check current quota usage
2. Reduce resource requirements
3. Request quota increase
4. Use different tenant

### VM Creation Fails
1. Check controller logs
2. Verify Proxmox connectivity
3. Check resource availability
4. Verify image exists

### Guest Agent Not Starting
1. Check VM logs
2. Verify package installation
3. Check systemd status
4. Review cloud-init logs

## Quick Reference

### Validation
```bash
./scripts/validate-and-optimize-vms.sh
```

### Quota Check
```bash
./scripts/pre-deployment-quota-check.sh
```

### Proxmox Resources
```bash
./scripts/check-proxmox-quota-ssh.sh
```

### Deploy VM
```bash
kubectl apply -f <vm-file>
```

### Check Status
```bash
kubectl get proxmoxvm -A
```

---

**Last Updated**: 2025-12-08

