| name | cluster-ops |
| description | Debug, clean, redeploy, and validate Spacebot's running deployment in the Talos Kubernetes cluster. Use when the user wants to check pod status, view logs, clean up a failed deployment, force a redeployment, troubleshoot a crash loop, inspect cluster resources, or validate Spacebot is running correctly. Also triggers on "pod logs", "restart spacebot", "why is spacebot down", "flux reconcile", "clean deploy", "redeploy", or "cluster status". |
Cluster Ops
Operational runbook for managing Spacebot's deployment in the Talos Kubernetes cluster. These commands run against the live cluster using kubectl, flux, and talosctl.
Before using this skill, read /cluster-context for the full cluster architecture reference.
Arguments
/cluster-ops <operation>
Operations: status, logs, clean, redeploy, debug, validate
Prerequisites
Verify cluster access before any operation:
kubectl get nodes 2>/dev/null && echo "cluster: connected" || echo "cluster: UNREACHABLE"
kubectl get namespace ai 2>/dev/null && echo "namespace: exists" || echo "namespace: MISSING"
If the cluster is unreachable, check:
kubeconfig file exists and is current
- VPN or network access to the cluster
talosctl health --talosconfig talosconfig for node-level issues
Status (/cluster-ops status)
Quick health check of all Spacebot resources:
kubectl get pods -n ai -l app.kubernetes.io/name=spacebot -o wide
flux get kustomization spacebot -n ai 2>/dev/null || echo "kustomization not found"
kubectl get helmrelease spacebot -n ai 2>/dev/null
kubectl get svc spacebot -n ai
kubectl get endpoints spacebot -n ai
kubectl get pvc -n ai -l app.kubernetes.io/name=spacebot
kubectl get httproute spacebot -n ai 2>/dev/null
kubectl get events -n ai --field-selector involvedObject.name=spacebot --sort-by='.lastTimestamp' | tail -20
Present results as a status dashboard:
## Spacebot Cluster Status
| Resource | Status | Details |
|----------|--------|---------|
| Pod | Running | 1/1 ready, uptime 3d |
| Service | Active | ClusterIP 10.x.x.x:19898 |
| PVC | Bound | 5Gi, 2.1Gi used |
| HTTPRoute | Attached | spacebot.example.com |
| Flux Kustomization | Applied | Last reconcile 5m ago |
Logs (/cluster-ops logs)
kubectl logs -n ai -l app.kubernetes.io/name=spacebot --tail=100
kubectl logs -n ai -l app.kubernetes.io/name=spacebot -f
kubectl logs -n ai -l app.kubernetes.io/name=spacebot --previous
kubectl logs -n ai -l app.kubernetes.io/name=spacebot --tail=500 | grep -E "ERROR|WARN"
For historical logs, query Loki via Grafana. Alloy collects container stdout/stderr automatically.
Clean (/cluster-ops clean)
Remove all Spacebot resources for a fresh redeployment. Adapted from the cluster project's clean workflow.
Step 1: Discover resources
kubectl get kustomization -A 2>/dev/null | grep -i spacebot
kubectl get all,configmap,secret,pvc,ciliumnetworkpolicy,httproute -n ai \
-l app.kubernetes.io/name=spacebot 2>/dev/null
kubectl get all,configmap,secret,pvc,ciliumnetworkpolicy,httproute -n ai 2>/dev/null \
| grep -i spacebot
Step 2: Present findings and confirm
Show the user exactly what will be deleted. Ask for confirmation unless --yes was passed.
Step 3: Suspend Flux
flux suspend kustomization spacebot -n ai
Step 4: Delete in order
kubectl delete deployment/spacebot -n ai --ignore-not-found
kubectl delete svc/spacebot httproute/spacebot ciliumnetworkpolicy/spacebot -n ai --ignore-not-found
kubectl delete configmap/spacebot-config secret/spacebot-secret -n ai --ignore-not-found
kubectl delete helmrelease/spacebot -n ai --ignore-not-found
kubectl delete secret -n ai -l owner=helm,name=spacebot --ignore-not-found
kubectl delete servicemonitor/spacebot -n ai --ignore-not-found
echo "Delete PVC spacebot-data? This destroys all Spacebot data. [y/N]"
Step 5: Verify clean
Re-run the discovery from Step 1. Report any remaining resources (stuck finalizers, etc.).
Redeploy (/cluster-ops redeploy)
Resume Flux reconciliation after a clean, or force a reconciliation on the existing deployment:
flux resume kustomization spacebot -n ai
flux reconcile kustomization spacebot -n ai --with-source
kubectl rollout status deployment/spacebot -n ai --timeout=120s
If the deployment fails to come up:
- Check events:
kubectl describe pod -n ai -l app.kubernetes.io/name=spacebot
- Check image pull: verify the image tag exists in the registry
- Check probes: startup probe may need a longer
failureThreshold if Spacebot takes time to initialize databases
Debug (/cluster-ops debug)
CrashLoopBackOff
POD=$(kubectl get pod -n ai -l app.kubernetes.io/name=spacebot -o jsonpath='{.items[0].metadata.name}')
kubectl describe pod "$POD" -n ai | grep -A5 "Last State"
kubectl logs "$POD" -n ai --previous
ImagePullBackOff
kubectl describe pod "$POD" -n ai | grep -A3 "Warning.*Failed"
Networking issues
kubectl exec -n ai "$POD" -- nslookup litellm.ai.svc.cluster.local
kubectl exec -n ai "$POD" -- wget -q -O- http://litellm.ai.svc.cluster.local:4000/health
kubectl get ciliumnetworkpolicy -n ai spacebot -o yaml
cilium connectivity test --single-node
Storage issues
kubectl get pvc spacebot-data -n ai -o yaml
kubectl exec -n ai "$POD" -- df -h /data
kubectl exec -n ai "$POD" -- du -sh /data/*
Exec into pod
kubectl exec -it -n ai "$POD" -- /bin/sh
kubectl debug -it -n ai "$POD" --image=busybox --target=spacebot
Validate (/cluster-ops validate)
Post-deployment validation checklist:
kubectl get pod -n ai -l app.kubernetes.io/name=spacebot -o jsonpath='{.items[0].status.phase}'
kubectl exec -n ai "$POD" -- wget -q -O- http://localhost:19898/api/health
kubectl exec -n ai "$POD" -- wget -q -O- http://localhost:9090/metrics | head -5
curl -s "https://spacebot.example.com/api/health"
kubectl exec -n monitoring -l app.kubernetes.io/name=prometheus -- \
wget -q -O- 'http://localhost:9090/api/v1/targets' | grep spacebot
flux get kustomization spacebot -n ai
Quick Reference
| Task | Command |
|---|
| Pod status | kubectl get pods -n ai -l app.kubernetes.io/name=spacebot |
| Tail logs | kubectl logs -n ai -l app.kubernetes.io/name=spacebot -f |
| Restart pod | kubectl rollout restart deployment/spacebot -n ai |
| Force reconcile | flux reconcile kustomization spacebot -n ai --with-source |
| Suspend Flux | flux suspend kustomization spacebot -n ai |
| Resume Flux | flux resume kustomization spacebot -n ai |
| Exec into pod | kubectl exec -it -n ai <pod-name> -- /bin/sh |
| Describe pod | kubectl describe pod -n ai -l app.kubernetes.io/name=spacebot |
| Events | kubectl get events -n ai --sort-by='.lastTimestamp' | grep spacebot |