Autoscaling Example

Prerequisites

  • The cluster should have metric-server running in the kube-system namespace

  • For Kind install ../../testing/scripts/metrics.yaml See https://github.com/kubernetes-sigs/kind/issues/398

  • For Minikube run:

    minikube addons enable metrics-server

Setup Seldon Core

Use the setup notebook to Setup Cluster with Ambassador Ingress and Install Seldon Core. Instructions also online.

!kubectl create namespace seldon
Error from server (AlreadyExists): namespaces "seldon" already exists
!kubectl config set-context $(kubectl config current-context) --namespace=seldon
Context "kind-ansible" modified.

Create model with v2beta1 autoscaler

To create a model with an HorizontalPodAutoscaler there are three steps:

  1. Ensure you have a resource request for the metric you want to scale on if it is a standard metric such as cpu or memory, e.g.:

          resources:
            requests:
              cpu: '0.5'
     
  1. Add an v2beta1 HPA Spec referring to this Deployment, e.g.:

The full SeldonDeployment spec is shown below.

Create Load

We label some nodes for the loadtester. We attempt the first two as for Kind the first node shown will be the master.

After a few mins you should see the deployment my-dep scaled to 3 deployments

Create model with v2 autoscaler

To create a model with an HorizontalPodAutoscaler there are three steps:

  1. Ensure you have a resource request for the metric you want to scale on if it is a standard metric such as cpu or memory, e.g.:

  1. Add an v2beta1 HPA Spec referring to this Deployment, e.g.:

The full SeldonDeployment spec is shown below.

Create Load

We label some nodes for the loadtester. We attempt the first two as for Kind the first node shown will be the master.

After a few mins you should see the deployment my-dep scaled to 3 deployments

Last updated

Was this helpful?