Overview
This guide walks you through deploying a Duchy to Amazon Elastic Kubernetes Service (EKS). Duchies on EKS can participate in the Halo measurement system alongside Kingdom deployments on GKE.Duchies deployed on EKS connect to a Kingdom deployed on GKE via public APIs. Cross-cloud deployment is fully supported.
Prerequisites
Complete the deployment prerequisites including:- Bazel/Bazelisk installation
- AWS CLI configuration
- kubectl installation
- Terraform installation
- Duchy registration with Kingdom operator
Duchy Registration
Before deployment, register your Duchy with the Kingdom operator (offline process):Prepare Registration Information
Share with the Kingdom operator:
- Duchy name (unique string ID, e.g.,
worker2) - CA (root) certificate
- Consent signaling (leaf) certificate
Duchy Components on EKS
For a Duchy namedworker2, the deployment creates:
Services
Services
worker2-async-computation-control-server(ClusterIP)worker2-internal-api-server(ClusterIP)worker2-computation-control-server(LoadBalancer) - System APIworker2-requisition-fulfillment-server(LoadBalancer) - Public API
Deployments
Deployments
worker2-async-computation-control-server-deploymentworker2-computation-control-server-deploymentworker2-herald-daemon-deploymentworker2-requisition-fulfillment-server-deploymentworker2-spanner-computations-server-deploymentworker2-mill-job-scheduler-deployment
PodTemplates (Mill Jobs)
PodTemplates (Mill Jobs)
worker2-llv2-mill- Liquid Legions v2 protocolworker2-hmss-mill- Honest Majority Share Shuffle protocol
CronJobs
CronJobs
worker2-computations-cleaner-cronjob
Network Policies
Network Policies
default-deny-network-policykube-dns-network-policy- Service-specific network policies
AWS Infrastructure
The deployment creates:- VPC with public, private, database, and intra subnets across 2 availability zones
- EKS Cluster (v1.29) with two node groups:
- Default: m5.large instances (max 2 nodes)
- High-performance: c5.xlarge instances (max 20 nodes) for computation mills
- RDS PostgreSQL for computation state storage
- S3 Bucket for blob storage
- Elastic IPs for stable external endpoints
Deployment Steps
Provision Infrastructure with Terraform
Use the example Terraform configuration:The configuration already includes S3 backend setup:Create Initialize and apply:
terraform.tfvars:terraform.tfvars
VPC CIDR is automatically set to
10.0.0.0/16 with subnets:- Private: 10.0.4.0/24, 10.0.5.0/24
- Public: 10.0.8.0/24, 10.0.9.0/24
- Database: 10.0.12.0/24, 10.0.13.0/24
- Intra: 10.0.16.0/24, 10.0.17.0/24
Get RDS Connection Info
Retrieve the RDS endpoint and secret name from Terraform outputs:Note the following for Kustomization generation:
postgres_host(e.g.,dev-postgres.c7lbzsffeehq.us-west-2.rds.amazonaws.com)postgres_port(typically5432)postgres_credential_secret_name(e.g.,rds!db-b4bebc1a-...)
Get Elastic IP Allocation IDs
Retrieve EIP allocation IDs for load balancers:Note these for the Kustomization build.
Generate Kubernetes Kustomization
Generate the K8s configuration for AWS:Extract to a secure location:
The
duchy_cert_id is provided by the Kingdom operator during registration.Customize Kubernetes Secret
Prepare files in
~/worker2-duchy-deployment/src/main/k8s/dev/worker2_duchy_secret/:Required Files:-
all_root_certs.pem- TLS trusted CA store -
worker2_tls.pem- Duchy’s TLS certificate (PEM format) -
worker2_tls.key- Private key for TLS certificate (PEM format) -
worker2_cs_cert.der- Consent signaling certificate (DER format) -
worker2_cs_private.der- Private key for consent signaling (DER format) -
duchy_cert_config.textproto- Duchy certificate to ID mapping -
xxx_protocols_setup_config.textproto- Protocol configuration- Replace
xxxwithaggregatorornon_aggregator
- Replace
-
worker2_kek.tink- Key encryption key for HMSS protocol
Customize Kubernetes ConfigMap
Place
authority_key_identifier_to_principal_map.textproto in:
~/worker2-duchy-deployment/src/main/k8s/dev/config_files/Certificate Management
Generate certificates using AWS Certificate Manager or your preferred CA. TLS Certificate Requirements:- Support both client and server TLS
- Include in Subject Alternative Name (SAN):
- Hostnames for load balancers
localhost
Athena Database Querying
Set up Athena to query the PostgreSQL database:Create Lambda Function
Follow AWS instructions to create an
athena_postgres_connector.Lambda Configuration:- SecretNamePrefix:
rds - ConnectionString:
postgres://jdbc:postgresql://{postgres_hostname}:5432/postgres?secret=${secret_name} - Subnets: Two database subnet IDs from VPC
- Security Groups: EKS cluster security group
Terraform Configuration Reference
Monitoring and Logging
Enable CloudWatch Container Insights:Testing the Deployment
Verify the Duchy works correctly:-
Connectivity Test: Ensure Duchy can reach Kingdom public API
- Correctness Test: Run a multi-cluster correctness test
Updating Configuration
To update secrets or configuration:Cost Optimization
Use Spot Instances for Mills
Use Spot Instances for Mills
Configure spot instances for the high-performance node group to reduce computation costs by up to 90%.
RDS Reserved Instances
RDS Reserved Instances
For production, purchase RDS reserved instances for 30-60% savings.
S3 Lifecycle Policies
S3 Lifecycle Policies
Configure automatic archival of old computation blobs to Glacier.
Next Steps
Operations Guide
Learn about managing the Duchy
Correctness Testing
Run end-to-end tests
Monitoring
Set up monitoring and alerts
Monitoring
Monitor your Duchy deployment