Building End-to-End MLOps Pipelines for Sentiment Analysis on Azure with Terraform, Kubeflow v2, Mlflow, and Seldon: Part 1

Rachit Ahuja
DataReply
Published in
3 min readJun 2, 2023

Introduction and Architecture Planning

Introduction:

The adoption of MLOps has become increasingly popular among Machine Learning engineers and data scientists, representing a significant trend in the field. MLOps involves the development of reusable workflows for training, testing, and inference of machine learning models. This article aims to provide a comprehensive guide on implementing an end-to-end MLOps pipeline, including model training and deployment on a Kubernetes-based infrastructure. It is part of a series covering various steps in this implementation. If you have any questions or collaboration requests, feel free to reach out.

Part 1: Introduction and Architecture Planning

Part 2: Developing Workflows for Infrastructure Deployment via CI/CD

Part 3: Setting up MLflow on AKS

Part 4: Setting up Kubeflow and Seldon on AKS

Part 5: End-to-End Training Pipeline and Inference Deployment using Seldon.

Architecture Design Components:

  • Kubeflow: Kubeflow is a machine learning platform designed to seamlessly integrate with Kubernetes, enabling the creation of scalable pipelines for model training and testing. While there are alternative methods for orchestrating end-to-end Machine Learning pipelines, such as creating graphs or using docker containers, Kubeflow offers notable advantages. By fully leveraging the strengths of Kubernetes, including features like Nodes, Persistence Volumes, and Network Policies, Kubeflow simplifies resource management and allocation, providing an efficient workflow for machine learning tasks.
  • Mlflow: Mlflow serves as a central hub for streamlining machine learning processes and developments. It offers functionalities such as experiment tracking, code packaging for reproducible runs, and model deployment in production. Mlflow integrates easily with existing ML applications, requiring minimal refactoring of the source code due to its user-friendly APIs. In this implementation, Mlflow will be used to track experiments, including parameter values and metrics for analyzing training results. If a trained model meets the required quality for production deployment, Mlflow provides a model registry for securely storing the final model artifacts. Additionally, Mlflow enables real-time updates on recorded metrics through its interface. The Mlflow server will run on one of the nodes in our cluster, with Azure PSQL and Azure Containers employed to store model logs and artifacts, respectively.
  • Seldon: Seldon is a set of machine learning tools designed to streamline and accelerate model deployment and management in a production environment. Acting as a bridge between Data Science and DevOps teams, Seldon accelerates the pace of bringing machine learning models to market and unlocking business value. Seldon Core, a production-ready tool, efficiently handles tasks such as model scaling, load management, and switching from REST requests to Grpc.

Architecture Overview

This section discusses the architecture to be developed for the implementation. While architectural design is typically the responsibility of Solutions Architects, having a clear architecture in mind can streamline the implementation process and provide an overview of the end product. For this implementation, the desired architecture includes the following elements:

  1. Centralized Code Repository: A centralized code repository will be utilized to store code and workflows for different parts of the project. Azure DevOps, offering mature pipelines and enterprise tooling, will be exploited for this purpose.
  2. Infrastructure as Code: Terraform will be employed to create infrastructure as code. Manual infrastructure creation will be avoided by creating separate CI/CD pipelines in Azure DevOps for infrastructure creation.
  3. Machine Learning Training with Kubeflow: Kubeflow, triggered programmatically using its Python API, will facilitate the actual machine learning training.
  4. Human Intervention and Supervision: Human intervention and supervision are crucial aspects of the MLOps workflow. Although an evaluation step will be included in the pipeline to select the best trained model based on a particular evaluation metric, the deployment of ML model serving using Seldon will be done manually.

Note: In an industrial scenario, separate Kubernetes clusters are usually used for model training and model deployment. However, for this mini implementation, everything will be performed on a single cluster.

By following this comprehensive guide, you can build end-to-end MLOps pipelines for sentiment analysis on Azure using Terraform, Kubeflow v2, Mlflow, and Seldon. Stay tuned for the upcoming parts in this series to learn more about each step of the implementation process.

End-to-End Architecture Diagram for Blogpost

--

--

Rachit Ahuja
DataReply

Machine learning and Data Engineer at Data Reply GmbH