# Kubernetes Deployment Status

**Date**: 2024-12-19  
**Status**: ⚠️ **Kubernetes Cluster Not Accessible**

## Current Status

### ✅ Completed (Without Kubernetes)
- Cloudflare credentials configured
- DNS records created
- Proxmox credentials configured and verified
- ProviderConfig file updated with actual credentials
- All scripts ready and tested
- Connectivity tests passed

### ⏳ Pending (Requires Kubernetes Cluster)
- Create Kubernetes secret
- Deploy Crossplane provider
- Apply ProviderConfig
- Verify deployment

## Kubernetes Cluster Status

**Current**: No cluster accessible
- kubectl: ✅ Installed
- Cluster connection: ❌ Not available
- Error: Connection timeout to `localhost:8080`

## Deployment Steps (When Cluster is Available)

### Prerequisites

1. **Ensure kubectl is configured**:
   ```bash
   kubectl cluster-info
   kubectl get nodes
   ```

2. **Verify cluster access**:
   ```bash
   # Should show cluster information
   kubectl version --client
   kubectl get namespaces
   ```

### Step 1: Create Kubernetes Secret

```bash
cd /home/intlc/projects/Sankofa
source .env

# Create namespace
kubectl create namespace crossplane-system

# Create secret with Proxmox credentials
kubectl create secret generic proxmox-credentials \
  --from-literal=username="${PROXMOX_USERNAME_ML110_01}" \
  --from-literal=token="${PROXMOX_TOKEN_ML110_01}" \
  -n crossplane-system

# Or use the script
./scripts/create-proxmox-secret.sh
```

**Verify**:
```bash
kubectl get secret proxmox-credentials -n crossplane-system
```

### Step 2: Deploy Crossplane Provider

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

# Or manually:
cd crossplane-provider-proxmox
make manifests
kubectl apply -f config/crd/bases/
kubectl apply -f config/provider.yaml
```

**Verify**:
```bash
kubectl get pods -n crossplane-system
kubectl get crd | grep proxmox
```

### Step 3: Apply ProviderConfig

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

**Verify**:
```bash
kubectl get providerconfig proxmox-provider-config
kubectl describe providerconfig proxmox-provider-config
```

### Step 4: Verify Deployment

```bash
./scripts/verify-provider-deployment.sh
```

**Manual verification**:
```bash
# Check provider pod
kubectl get pods -n crossplane-system -l app=crossplane-provider-proxmox

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

# Check ProviderConfig status
kubectl get providerconfig proxmox-provider-config -o yaml
```

## Quick Deployment (All Steps)

Once Kubernetes cluster is available:

```bash
cd /home/intlc/projects/Sankofa

# 1. Create secret
./scripts/create-proxmox-secret.sh

# 2. Deploy provider
./scripts/deploy-crossplane-provider.sh

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

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

## Troubleshooting

### No Cluster Access

**Issue**: `kubectl cluster-info` fails or times out

**Solutions**:
1. **Check kubeconfig**:
   ```bash
   ls -la ~/.kube/config
   export KUBECONFIG=~/.kube/config
   ```

2. **Set cluster context**:
   ```bash
   kubectl config get-contexts
   kubectl config use-context <context-name>
   ```

3. **Create local cluster (for testing)**:
   ```bash
   # Using kind
   kind create cluster --name proxmox-test
   
   # Using minikube
   minikube start
   ```

### Provider Not Starting

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

**Check CRDs**:
```bash
kubectl get crd | grep proxmox
```

**Check secret**:
```bash
kubectl get secret proxmox-credentials -n crossplane-system -o yaml
```

### ProviderConfig Errors

**Check ProviderConfig**:
```bash
kubectl describe providerconfig proxmox-provider-config
```

**Check secret reference**:
```bash
kubectl get secret proxmox-credentials -n crossplane-system
```

## Files Ready for Deployment

All configuration files are ready:

- ✅ `.env` - All credentials configured
- ✅ `crossplane-provider-proxmox/examples/provider-config.yaml` - Updated with credentials
- ✅ All deployment scripts ready
- ✅ CRD manifests ready
- ✅ Provider manifest ready

## Next Steps

1. **Set up Kubernetes cluster** (if not available)
   - Use kind, minikube, or existing cluster
   - Configure kubeconfig

2. **Run deployment steps** (in order)
   - Create secret
   - Deploy provider
   - Apply ProviderConfig
   - Verify

3. **Test deployment**
   - Deploy test VMs
   - Verify operations

## Related Documentation

- [Deployment Readiness](./DEPLOYMENT_READINESS.md)
- [Quick Start Guide](./QUICK_START.md)
- [Deployment Guide](./DEPLOYMENT_GUIDE.md)

