Using Deployment Configurations

Estimated completion time: 11m.

This tutorial is relevant only for Kubernetes installation of Hydrosphere. Please refer to How to Install Hydrosphere on Kubernetes cluster.


In this tutorial, you will learn how to configure deployed Applications.

By the end of this tutorial you will know how to:


Upload a Model

In this section, we describe the resources required to create and upload an example model used in further sections. If you have no prior experience with uploading models to the Hydrosphere platform we suggest that you visit the Getting Started Tutorial.

Here are the resources used to train sklearn.ensemble.GradientBoostingClassifier and upload it to the Hydrosphere cluster.

requirements.txt is a list of Python dependencies used during the process of building model image.


Our folder structure should look like this:

├── model.joblib
├── requirements.txt
├── serving.yaml
└── src

Do not forget to run python to generate model.joblib!

After we have made sure that all files are placed correctly, we can upload the model to the Hydrosphere platform by running hs apply from the command line.

hs apply -f serving.yaml

Create a Deployment Configuration

Next, we are going to create and upload an instance of Deployment Configuration to the Hydrosphere platform.

Deployment Configurations describe with which Kubernetes settings Hydrosphere should deploy servables. You can specify Pod Affinity and Tolerations, the number of desired pods in deployment, ResourceRequirements, and Environment Variables for the model container, and HorizontalPodAutoScaler settings.

Created Deployment Configurations can be attached to Servables and Model Variants inside of Application.

Deployment Configurations are immutable and cannot be changed after they've been uploaded to the Hydrosphere platform.

You can create and upload Deployment Configuration to Hydrosphere via YAML Resource definition or via Python SDK.

For this tutorial, we'll create a deployment configuration with 2 initial pods per deployment, HPA, and FOO environment variable with value bar.

Create the deployment configuration resource definition:

kind: DeploymentConfiguration
name: my-dep-config
  replicaCount: 2
  minReplicas: 2
  maxReplicas: 4
  cpuUtilization: 70
    FOO: bar

To upload it to the Hydrosphere platform, run:

hs apply -f deployment_configuration.yaml

Create an Application

Create the application resource definition:

kind: Application
name: my-app-with-config
  model: my-model:1
  deployment-config: my-dep-config

To upload it to the Hydrosphere platform, run:

hs apply -f application.yaml

Examine Kubernetes Settings


You can check whether with_replicas was successful by calling kubectl get deployment -A -o wide and checking the READYcolumn.


To check whether with_hpa was successful you should get a list of all created Horizontal Pod Autoscaler Resources. You can do so by calling kubectl get hpa -A

The output is similar to:

NAME                        REFERENCE                                            TARGETS    MINPODS   MAXPODS   REPLICAS   AGE
my-model-1-tumbling-star    CrossVersionObjectReference/my-model-1-tumbling-star 20%/70%    2         4         2          1d

Environment Variables

To list all environment variables run kubectl exec my-model-1-tumbling-star -it /bin/bash and then execute the printenv command which prints ann system variables.

The output is similar to:


Last updated