Defining Disruption Budgets for Seldon Deployments — seldon-core documentation (original) (raw)

Prerequisites

Setup Seldon Core

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

!kubectl create namespace seldon

!kubectl config set-context $(kubectl config current-context) --namespace=seldon

Create model with Pod Disruption Budget

To create a model with a Pod Disruption Budget, it is first important to understand how you would like your application to respond to voluntary disruptions. Depending on the type of disruption budgeting your application needs, you will either define either of the following:

The full SeldonDeployment spec is shown below.

!pygmentize model_with_pdb.yaml

!kubectl apply -f model_with_pdb.yaml

!kubectl rollout status deploy/$(kubectl get deploy -l seldon-deployment-id=seldon-model -o jsonpath='{.items[0].metadata.name}')

Validate Disruption Budget Configuration

import json

def getPdbConfig(): dp = !kubectl get pdb seldon-model-example-0-classifier -o json dp = json.loads("".join(dp)) return dp["spec"]["maxUnavailable"]

assert getPdbConfig() == 2

!kubectl get pods,deployments,pdb

Update Disruption Budget and Validate Change

Next, we’ll update the maximum number of unavailable pods and check that the PDB is properly updated to match.

!pygmentize model_with_patched_pdb.yaml

!kubectl apply -f model_with_patched_pdb.yaml

!kubectl rollout status deploy/$(kubectl get deploy -l seldon-deployment-id=seldon-model -o jsonpath='{.items[0].metadata.name}')

assert getPdbConfig() == 1

Clean Up

!kubectl get pods,deployments,pdb

!kubectl delete -f model_with_patched_pdb.yaml