Efficient Machine Learning Model Deployment: Integrating Seldon into MLOps Workflows

Utilizing Seldon for Scalable, Monitorable, and Efficient MLOps

Seldon Deployment in Kubernetes Environment

Enhancing MLOps with Seldon: Advantages and Practical Deployment with Scikit-Learn

Deploying machine learning models can often be a complex process that extends beyond the model’s development. The ease with which these models transition into production can significantly impact their usefulness and applicability. In this context, Seldon Core offers a suite of features that cater to various aspects of MLOps with a particular emphasis on ease of monitoring, scaling, and deployment. In this article, I’ll outline some of the features I appreciate about Seldon and walk through the deployment of a Scikit-Learn classifier using Seldon’s tools.

Advantages of Using Seldon in MLOps

Easy Monitoring with Prometheus: One of the more tedious aspects of machine learning operations is setting up monitoring for deployed models. Seldon simplifies this by providing out-of-the-box integration with Prometheus, a powerful monitoring system that automatically collects and stores metrics in a time-series database. This integration allows for real-time monitoring of a wide array of model performance metrics, without the need for complex setup procedures.

Automatic Scaling with KEDA: Maintaining the balance between resource allocation and cost-efficiency is key in production environments. Seldon integrates with Kubernetes Event-driven Autoscaling (KEDA) to facilitate automatic scaling of machine learning models. KEDA allows Seldon deployments to scale based on metrics from external sources like Kafka queues, providing a responsive and resource-efficient solution for handling variable workloads. This is especially useful for scaling to zero, which allows for significant cost savings when the model is not in use.

Seamless Deployments: The need for smooth rollouts and updates to machine learning models cannot be overstated. Seldon supports seamless deployments, allowing for blue-green testing, canary rollouts, and phased introductions of new model versions. This results in reduced downtime and improved user experience, as new features or models can be tested and rolled out with minimal disruption to the production service.

Practical Deployment: A Scikit-Learn Classifier Example

To demonstrate the advantages mentioned above, let’s consider the deployment of a simple logistic regression classifier using Scikit-Learn, wrapped with Seldon’s Sklearn server.

from sklearn import datasets
from sklearn.linear_model import LogisticRegression
import joblib

# Load Iris dataset
iris = datasets.load_iris()
X, y = iris.data, iris.target

# Create and train the logistic regression model
model = LogisticRegression()
model.fit(X, y)

# Serialize the model to a file
joblib.dump(model, 'model.joblib')

After training and saving the model, we create a SeldonDeployment custom resource definition (CRD) that outlines the deployment specifics:

apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
  name: iris-model
    - name: default
      replicas: 1
        name: iris-classifier
        implementation: SKLEARN_SERVER
        modelUri: gs://my-bucket/iris-model
        envSecretRefName: seldon-init-container-secret

Using kubectl, we apply the manifest to our Kubernetes cluster, which triggers the deployment process orchestrated by Seldon Core. In the end, it will create a new plain Kubernetes deployment with a pod running our model. The pod will be exposed via a Kubernetes service, which can be used to send requests to the model. Depending on the deployment setup, it can also be exposed via an Istio gateway, which allows for more advanced traffic management and monitoring.

If we make updates, we should create a new version of the model and update the SeldonDeployment CRD to point to the new model version. This will trigger a rolling update of the deployment, which will ensure that the model is updated without any downtime.

Advanced Deployment Options

For more advanced use cases, Seldon also provides support for other machine learning frameworks like TensorFlow, PyTorch, and XGBoost, as well as integration with other tools like KubeFlow and Kubeflow Pipelines. It is also possible to wrap your own custom model code with Seldon’s Python server. This gives extreme flexibility in terms of deployment options, allowing for a wide range of use cases without the need for extensive deployment code.

Monitoring and Predicting with Your Deployed Model

With our model deployed, we can utilize Prometheus to monitor it closely. This setup allows us to keep track of our model’s performance and health with ease. Prometheus can be queried to fetch relevant metrics, which aids in maintaining the robustness of the deployed model. More information can be found in the Seldon documentation.


By providing built-in support for monitoring, scaling, and deployment, Seldon Core addresses three critical aspects of MLOps, making the journey from model development to production a lot smoother. This simplifies many of the operational complexities and allows data scientists and ML engineers to focus more on model improvement and less on the intricacies of production environments. As we’ve seen, leveraging Seldon Core with a Scikit-Learn model can be a very straightforward process, illustrating how practical and beneficial Seldon can be in real-world applications.

Lukas Pfannschmidt
Lukas Pfannschmidt
Sr. Machine Learning Engineer

My expertise now encompasses advanced areas in machine learning and backend system optimization. My work in backend optimization, particularly in managing large-scale data efficiently, aligns with key optimization metrics like cost, quality, and speed. I also contribute to improving overall system reliability and observability, significantly reducing error rates and establishing critical technical metrics. These endeavors complement my previous research interests in high-performance computing.