Overview
Cloud deployment uses Google Kubernetes Engine (GKE) to run agents in a managed Kubernetes environment. This provides high availability, automatic scaling, and seamless integration with Google Cloud services.Architecture
Prerequisites
Google Cloud Account
Active GCP project with billing enabled
GKE Cluster
Running Kubernetes cluster in your GCP project
kubectl
Kubernetes command-line tool configured for your cluster
Docker Image
Built and pushed to container registry (GHCR)
Deployment Architecture
Kubernetes Resources
The application runs in theagents namespace with multiple deployments:
Deployment
Main prediction market agent deployment running configured agents
Deployment
Monitoring and observability services for agent performance tracking
Deployment
Autonomous trading agent with microchain framework (deployed here)
Deployment
Web interface for viewing deployed agent status and performance
Deployment
Treasury management service for fund allocation and tracking
Setup Instructions
1
Configure kubectl
Connect kubectl to your GKE cluster:Verify connection:
2
Create Namespace
Create the Set as default namespace:
agents namespace if it doesn’t exist:3
Configure Secrets
Create Kubernetes secrets for sensitive environment variables:
4
Create Deployment
Create a deployment manifest:Apply the deployment:
deployment.yaml
5
Verify Deployment
Check deployment status:
Deployment Configuration
Environment Variables
Configure agents via environment variables in your deployment:Resource Limits
Set appropriate resource requests and limits:Image Pull Policy
For production, use specific tags instead oflatest:
Managing Deployments
Restarting Deployments
Therestart_app_deployments.sh script restarts all agent deployments to pick up new container images:
restart_app_deployments.sh
This script is currently used until CI/CD pipeline integration with GKE is complete. DevOps is working on securing the connection between GitHub and GKE for automated deployments.
Rolling Updates
Kubernetes performs rolling updates automatically when you change the deployment:Scaling
Scale deployments up or down:Rollback
Rollback to a previous deployment version:Multiple Agent Deployment
Run multiple agents simultaneously with different configurations:Monitoring and Observability
Viewing Logs
Pod Status
Resource Usage
Deployment Dashboard
View agent activity on the Dune dashboard:AI Agents Overview
Track on-chain activity of deployed agents from this repo
Configuration Management
ConfigMaps
Use ConfigMaps for non-sensitive configuration:Secrets Management
Integrate with Google Secret Manager:CI/CD Pipeline
Current State
Images are automatically built and pushed to GitHub Container Registry on:- Pushes to
mainbranch - Pull requests with “build please” in description
Deployment Process
1
Code Push
Developer pushes code to GitHub
2
CI Build
GitHub Actions builds Docker image and pushes to GHCR
Manual Deployment
Currently, deployments are manually triggered using
restart_app_deployments.sh4
Future: Automated CD
DevOps is working on automating deployment after successful builds
The deployment process will be fully automated once the connection between GitHub Actions and GKE is secured.
High Availability
Multiple Replicas
Run multiple replicas for redundancy:Pod Disruption Budget
Ensure minimum availability during updates:Health Checks
Add liveness and readiness probes:Cost Optimization
Right-size Resources
Right-size Resources
Start with smaller resource requests and scale up based on actual usage:Adjust resource limits based on observed consumption.
Use Preemptible Nodes
Use Preemptible Nodes
For non-critical workloads, use GKE’s preemptible nodes for ~80% cost savings:
Horizontal Pod Autoscaling
Horizontal Pod Autoscaling
Scale pods based on actual demand:
Cluster Autoscaling
Cluster Autoscaling
Enable GKE cluster autoscaling to add/remove nodes based on pod requirements.
Troubleshooting
ImagePullBackOff
ImagePullBackOff
Pod can’t pull the Docker image:
CrashLoopBackOff
CrashLoopBackOff
Pod keeps crashing:
Pending Pods
Pending Pods
Pods stuck in Pending state:
Resource Exhaustion
Resource Exhaustion
Out of memory or CPU:
Next Steps
Environment Config
Complete environment variable reference for all agents
Docker Deployment
Learn about the Docker build and container setup
Local Development
Test agents locally before deploying to cloud
Monitoring Dashboard
View live agent performance and activity