Ensuring high availability (HA) is crucial for maintaining uptime, minimizing service disruption, and supporting critical workloads in production. This guide explains how to design, deploy, and operate Prisme.ai with HA in mind on Kubernetes.


Why High Availability Matters

A high-availability deployment ensures:

  • No single point of failure
  • Redundant services distributed across zones or regions
  • Automated failover and recovery
  • Increased uptime for business-critical use cases

Key HA Components


Example: Minimal HA Setup

apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-gateway
spec:
  replicas: 3
  selector:
    matchLabels:
      app: api-gateway
  template:
    metadata:
      labels:
        app: api-gateway
    spec:
      containers:
      - name: api-gateway
        image: prismeai/api-gateway:latest
        ports:
        - containerPort: 3001
        livenessProbe:
          httpGet:
            path: /health
            port: 3001
          initialDelaySeconds: 5
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /ready
            port: 3001
          initialDelaySeconds: 5
          periodSeconds: 10

Resilient Databases

MongoDB Replica Set

  • Deploy MongoDB as a 3-node replica set.
  • Use StatefulSets and persistent volumes.
  • Prefer managed services with automatic failover.

Elasticsearch Cluster

  • Use 3 data nodes and 3 master nodes.
  • Enable snapshot-based backups.
  • Ensure cluster quorum during restarts or scaling.

Redis HA

  • Use Redis Sentinel or Redis Cluster.
  • Use persistent storage and multi-zone replication.
  • Prefer managed Redis services like AWS ElastiCache or Azure Cache for Redis.

Storage Redundancy

  • Ensure shared volumes (for uploads or workspace files) are RWX and support replication.
  • Use cloud-native backup and snapshot solutions.

Monitoring and Self-Healing

  • Use Prometheus and Grafana for live dashboards and alerting.
  • Implement Kubernetes PodDisruptionBudgets (PDBs) to prevent all pods from being evicted at once.
  • Add Horizontal Pod Autoscalers (HPA) for runtime services.

Example PodDisruptionBudget:

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: runtime-ha-pdb
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: runtime

Next Steps