CASE STUDY

From Instability to Scalability: Building an Event-Driven, Kubernetes-Based AI Platform

SWEDISH AI STARTUP, 2023

Context & Client Challenges

The client, a Swedish AI startup, offers Internet of Things (IoT) solutions designed to optimize commercial building energy consumption. Their daily operations rely on a cycle of data collection, processing, and machine learning: data is collected via API, an optimization process runs for each building every 10 minutes, and a daily training process updates building-specific models.

The initial infrastructure, hosted on Microsoft Azure, utilized Azure App Services for APIs and a self-managed Ray cluster for AI workloads. A SQL database served as a basic logging database but lacked support for critical metrics, alerts, or automated remedial actions. Code integration occurred via Bitbucket, while AI code deployment was entirely manual.

This architecture presented several significant operational and cost challenges:

The Solution

The solution was a comprehensive re-architecture of the client's platform into a new Kubernetes-based platform designed for AI at scale, focusing on high availability, scalability, fault tolerance, disaster recovery, and operational efficiency. The core objective of the re-architecture was to replace the unstable, manual, and unobservable legacy system with a robust, event-driven infrastructure built on Azure Kubernetes Service (AKS) 

Key Architectural Components

The new platform leverages several modern cloud-native tools to achieve operational excellence:

  1. Kubernetes Cluster: The foundational layer running self-hosted applications, leveraging Azure constructs like Availability Zones (AZs) for resilience.

  2. Observability Stack: A dedicated system for monitoring and logging.

    • Prometheus and Grafana for metrics and visual dashboards.

    • Loki and Promtail for log aggregation and search.

    • Azure Monitor integrates resource graphs and logs.

    • Alerting via Slack and Webhook applications enables proactive notifications and automated remediations.

  3. Pub/Sub and Streams: Redis Streams were implemented for asynchronous communication between services, ensuring processes are event-driven.

  4. CI/CD and IaAC: The build and deployment pipeline utilizes Jenkins and Helm for automated, reproducible deployments (Infrastructure as a Code).

Results and Business Impact

The implementation of the new, event-driven, Kubernetes-based AI platform delivered substantial improvements across all key operational areas. By adopting a modern cloud-native architecture, we successfully addressed the client’s performance, cost, and operational challenges, providing a foundation for scalable and reliable growth.

Enhanced Performance, Reliability, and Observability

The migration from a fragile, self-managed Ray cluster to a stable Azure Kubernetes Service (AKS) environment drastically improved system stability and incident response times.

Streamlined Development Lifecycle and Operational Efficiency

Automating the build and deployment process via Jenkins and Helm transformed the client's development velocity and reliability.

Significant Infrastructure Cost Optimization

The implementation of asset hygiene measures and leveraging Kubernetes’ inherent scaling capabilities immediately addressed the escalating infrastructure bills.