Skip to main content

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 the agents 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 agents namespace if it doesn’t exist:
Set as default namespace:
3

Configure Secrets

Create Kubernetes secrets for sensitive environment variables:
Never commit secrets to version control. Use secret management tools like Google Secret Manager.
4

Create Deployment

Create a deployment manifest:
deployment.yaml
Apply the deployment:
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 of latest:
For development, always pull latest:

Managing Deployments

Restarting Deployments

The restart_app_deployments.sh script restarts all agent deployments to pick up new container images:
restart_app_deployments.sh
Run the script:
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:
Reference in deployment:

Secrets Management

Integrate with Google Secret Manager:
Use with Workload Identity or External Secrets Operator for automatic secret injection.

CI/CD Pipeline

Current State

Images are automatically built and pushed to GitHub Container Registry on:
  • Pushes to main branch
  • 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.sh
4

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

Start with smaller resource requests and scale up based on actual usage:
Adjust resource limits based on observed consumption.
For non-critical workloads, use GKE’s preemptible nodes for ~80% cost savings:
Scale pods based on actual demand:
Enable GKE cluster autoscaling to add/remove nodes based on pod requirements.

Troubleshooting

Pod can’t pull the Docker image:
Pod keeps crashing:
Pods stuck in Pending state:
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