218 lines
4.9 KiB
Markdown
218 lines
4.9 KiB
Markdown
# DCOS — Kubernetes Deployment
|
|
|
|
Kubernetes deployment for the Distributed Cognitive Operating System. Follows the standard homelab pattern (Traefik ingress, cert-manager TLS, local-path PVCs).
|
|
|
|
---
|
|
|
|
## Quick Deploy
|
|
|
|
```bash
|
|
# One-command deploy (follows your pattern)
|
|
bash runmefirst.sh
|
|
```
|
|
|
|
---
|
|
|
|
## What Gets Deployed
|
|
|
|
| Resource | Name | Purpose |
|
|
|----------|------|---------|
|
|
| Namespace | `dcos-service` | Isolation |
|
|
| Deployment | `dcos` | Main DCOS pods |
|
|
| Service | `dcos` | ClusterIP:8080 |
|
|
| Ingress | `dcos` | `dcos.celestium.life` |
|
|
| PVC | `dcos-memory-pvc` | 20Gi memory store |
|
|
| PVC | `dcos-config-pvc` | 2Gi config |
|
|
| ServiceAccount | `dcos` | Pod identity |
|
|
| Middleware | `dcos-stripprefix` | Traefik path stripping |
|
|
|
|
---
|
|
|
|
## Files
|
|
|
|
| File | Purpose |
|
|
|------|---------|
|
|
| [`deployment.yaml`](deployment.yaml) | Deployment: 1 replica, 4 CPU/4Gi RAM, PVC mounts |
|
|
| [`service.yaml`](service.yaml) | ClusterIP service on port 8080 |
|
|
| [`ingress.yaml`](ingress.yaml) | Traefik ingress → `dcos.celestium.life` with TLS |
|
|
| [`pvc.yaml`](pvc.yaml) | 20Gi memory + 2Gi config (local-path) |
|
|
| [`serviceaccount.yaml`](serviceaccount.yaml) | Service account |
|
|
| [`middleware.yaml`](middleware.yaml) | Traefik Middleware for path stripping |
|
|
| [`values.yaml`](values.yaml) | Helm values (image, resources, autoscaling) |
|
|
| [`runmefirst.sh`](runmefirst.sh) | Namespace + kubectl apply |
|
|
|
|
---
|
|
|
|
## Helm Values
|
|
|
|
Key values in [`values.yaml`](values.yaml):
|
|
|
|
```yaml
|
|
image:
|
|
repository: ghcr.io/celesrenata/dcos
|
|
tag: "1.0.0"
|
|
pullPolicy: IfNotPresent
|
|
|
|
service:
|
|
type: ClusterIP
|
|
port: 8080
|
|
|
|
ingress:
|
|
enabled: true
|
|
hosts:
|
|
- name: dcos.celestium.life
|
|
tls:
|
|
- secretName: dcos-cert
|
|
|
|
resources:
|
|
limits:
|
|
cpu: "4"
|
|
memory: "4Gi"
|
|
|
|
autoscaling:
|
|
enabled: false
|
|
minReplicas: 1
|
|
maxReplicas: 10
|
|
|
|
dcos:
|
|
maxAgents: 100
|
|
selfOrgEnabled: true
|
|
decentralized: true
|
|
```
|
|
|
|
---
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
# Deploy
|
|
bash runmefirst.sh
|
|
|
|
# Helm install
|
|
helm upgrade -i dcos . --namespace dcos-service --create-namespace -f values.yaml
|
|
|
|
# Helm upgrade with new image
|
|
helm upgrade -i dcos . --namespace dcos-service --set image.tag="1.0.1"
|
|
|
|
# Scale
|
|
kubectl scale deployment dcos --replicas=3 -n dcos-service
|
|
|
|
# Port-forward for local testing
|
|
kubectl port-forward service/dcos 8080:8080 -n dcos-service
|
|
|
|
# Check status
|
|
kubectl get all -n dcos-service
|
|
|
|
# View logs
|
|
kubectl logs -f deployment/dcos -n dcos-service
|
|
|
|
# Exec into pod
|
|
kubectl exec -it deployment/dcos -n dcos-service -- python -m dcos --init
|
|
|
|
# Uninstall
|
|
helm uninstall dcos --namespace dcos-service
|
|
kubectl delete -f pvc.yaml -n dcos-service
|
|
kubectl delete namespace dcos-service
|
|
```
|
|
|
|
---
|
|
|
|
## Storage
|
|
|
|
### PVC Details
|
|
|
|
| PVC | Size | StorageClass | Mount Path | Contents |
|
|
|-----|------|-------------|------------|----------|
|
|
| `dcos-memory-pvc` | 20Gi | local-path | `/app/data/memory_store` | SQLite databases |
|
|
| `dcos-config-pvc` | 2Gi | local-path | `/app/config` | YAML configs |
|
|
|
|
### Persistent Data
|
|
|
|
Memory databases are stored in `data/memory_store/`:
|
|
|
|
```
|
|
memory_store/
|
|
├── episodic.db # Episodic memory (temporal events)
|
|
├── knowledge_graph.db # Semantic memory (knowledge graph)
|
|
├── learning.db # Learning data
|
|
├── long_term.db # Long-term memory
|
|
├── procedural.db # Procedural memory (patterns)
|
|
├── user_model.db # User model
|
|
└── world_model.db # World model
|
|
```
|
|
|
|
---
|
|
|
|
## Networking
|
|
|
|
### Service
|
|
|
|
```
|
|
dcos.celestium.life
|
|
│
|
|
▼
|
|
Ingress (traefik) → TLS (cert-manager)
|
|
│
|
|
▼
|
|
Service (ClusterIP:8080) → Sticky cookies (8h)
|
|
│
|
|
▼
|
|
Pod:8080
|
|
```
|
|
|
|
### Ingress Annotations
|
|
|
|
```yaml
|
|
traefik.ingress.kubernetes.io/affinity: "true"
|
|
traefik.ingress.kubernetes.io/service.sticky.cookie: "true"
|
|
traefik.ingress.kubernetes.io/service.sticky.cookie.maxage: "28800"
|
|
cert-manager.io/cluster-issuer: ca-issuer
|
|
```
|
|
|
|
---
|
|
|
|
## Monitoring
|
|
|
|
```bash
|
|
# Pod health
|
|
kubectl get pods -n dcos-service -w
|
|
|
|
# PVC usage
|
|
kubectl get pvc -n dcos-service
|
|
|
|
# Ingress
|
|
kubectl get ingress -n dcos-service
|
|
|
|
# Service endpoints
|
|
kubectl get endpoints -n dcos-service
|
|
|
|
# Resource usage
|
|
kubectl top pods -n dcos-service
|
|
```
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
| Problem | Check | Solution |
|
|
|---------|-------|----------|
|
|
| Pod not starting | `kubectl describe pod dcos-* -n dcos-service` | Check events for image pull errors |
|
|
| PVC pending | `kubectl get pvc -n dcos-service` | Verify `local-path` storage class exists |
|
|
| Ingress not routing | `kubectl get ingress -n dcos-service` | Check Traefik config |
|
|
| TLS errors | `kubectl get certificates -n dcos-service` | Verify cert-manager is running |
|
|
| Memory full | `kubectl exec dcoss-*/df -h /app/data` | Expand PVC or clean old data |
|
|
|
|
---
|
|
|
|
## Image
|
|
|
|
```
|
|
Repository: ghcr.io/celesrenata/dcos
|
|
Tags: 1.0.0 (production), latest (development), <commit> (CI)
|
|
Pull Policy: IfNotPresent (production), Always (development)
|
|
```
|
|
|
|
---
|
|
|
|
*Deployed to `dcos-service` namespace. Ingress at `dcos.celestium.life`.*
|