# AiWorker Kubernetes HA Cluster
**Location**: Houston, Texas (us-hou-1)
**Created**: 2026-01-19
**K3s Version**: v1.35.0+k3s1
**Network**: 10.100.0.0/24 (k8s-cluster-network)

## Architecture
```
                    [Floating IP]
                         |
            ┌────────────┴────────────┐
            |                         |
      [LB-01 (HA)]            [LB-02 (HA)]
            |                         |
            └────────────┬────────────┘
                         |
         ┌───────────────┼───────────────┐
         |               |               |
    [CP-01]         [CP-02]         [CP-03]
    etcd HA          etcd HA         etcd HA
         |               |               |
    ─────┴───────────────┴───────────────┴─────
         |               |               |
    [Worker-01]     [Worker-02]     [Worker-03]
```

## Control Plane Nodes (gp.starter: 4 vCPU, 8 GB RAM)
| Hostname    | Public IP       | Private IP  | Role             |
|-------------|-----------------|-------------|------------------|
| k8s-cp-01   | 108.165.47.233  | 10.100.0.2  | control-plane,etcd |
| k8s-cp-02   | 108.165.47.235  | 10.100.0.3  | control-plane,etcd |
| k8s-cp-03   | 108.165.47.215  | 10.100.0.4  | control-plane,etcd |

## Worker Nodes (gp.small: 8 vCPU, 16 GB RAM)
| Hostname       | Public IP       | Private IP  | Role   |
|----------------|-----------------|-------------|--------|
| k8s-worker-01  | 108.165.47.225  | 10.100.0.5  | worker |
| k8s-worker-02  | 108.165.47.224  | 10.100.0.6  | worker |
| k8s-worker-03  | 108.165.47.222  | 10.100.0.7  | worker |

## Load Balancers (gp.micro: 2 vCPU, 4 GB RAM)
| Hostname   | Public IP    | Private IP  | Purpose         |
|------------|--------------|-------------|-----------------|
| k8s-lb-01  | (pending)    | (pending)   | HAProxy Primary |
| k8s-lb-02  | (pending)    | (pending)   | HAProxy Backup  |

## K3s Configuration
```bash
# Token
K10e74a5aacfaf4e2e0a291c3b369db8588cf0b9c2590a4d66e04ab960e24fcb4db::server:bc53704a9707d3cd9188af9e558ab50c

# API Server (via LB - will be configured)
https://<floating-ip>:6443

# Direct access (temporary)
https://108.165.47.233:6443
```

## Network Configuration
- **Private Network**: 10.100.0.0/24 (eth1)
- **Flannel Interface**: eth1
- **All internal communication**: via private IPs
- **External access**: via public IPs (with firewall)

## SSH Access
```bash
# Control Planes
ssh root@108.165.47.233  # k8s-cp-01
ssh root@108.165.47.235  # k8s-cp-02
ssh root@108.165.47.215  # k8s-cp-03

# Workers
ssh root@108.165.47.225  # k8s-worker-01
ssh root@108.165.47.224  # k8s-worker-02
ssh root@108.165.47.222  # k8s-worker-03
```

## Kubeconfig
```bash
# Local kubeconfig
~/.kube/aiworker-config

# Usage
export KUBECONFIG=~/.kube/aiworker-config
kubectl get nodes

# Or
kubectl --kubeconfig ~/.kube/aiworker-config get nodes
```

## Cost Summary
| Component       | Plan       | Qty | Unit Price | Total/Month |
|-----------------|------------|-----|------------|-------------|
| Control Planes  | gp.starter | 3   | $15/mo     | $45         |
| Workers         | gp.small   | 3   | $29/mo     | $87         |
| Load Balancers  | gp.micro   | 2   | $8/mo      | $16         |
| **Total**       |            | 8   |            | **$148/mo** |

## Cluster Health
```bash
# Check nodes
kubectl get nodes -o wide

# Check system pods
kubectl get pods -A

# Check etcd cluster
kubectl get endpoints -n kube-system kube-apiserver

# Cluster info
kubectl cluster-info
```

## Next Steps
1. ✅ Cluster deployed
2. 🔄 Configure load balancers (HAProxy)
3. ⏳ Setup floating IP for HA
4. ⏳ Install Nginx Ingress Controller
5. ⏳ Install Cert-Manager
6. ⏳ Deploy AiWorker application
