We use analytics and cookies to understand site traffic. Information about your use of our site is shared with Google for that purpose.You can read our privacy policies and terms of use etc by clicking here.
Command Line Interface
Experimental
Thesd
command line interface is considered experimental.
The following commands could change at any time and breaking changes are
expected.
The sd
command line interface allows you to access Seldon Deploy
programatically.
This allows you to trigger deployments and promotions directly from your
training or CI pipelines.
Getting Started
To use it, you can run the pre-built seldonio/sd
image.
Note that you can use this image directly as a container on your CI pipeline.
docker run -it --rm seldonio/sd:0.2.3 sd
Authentication
The sd
CLI supports authentication by providing your Seldon Deploy user and
password on each call.
This means that it can be used from outside the Kubernetes cluster, pointing
the tool the external Seldon Deploy domain.
You can see an example below:
sd list \
--server https://ml.example.org/seldon-deploy \
--user jdoe \
--password 232323 \
--namespace staging
Dex
The sd
CLI supports authentication when Dex is configured at the ingress
gateway or app level.
At the moment, it will only work when Dex only has a single authentication provider configured. For example, if you configure access to an LDAP server in Dex, you must disable other sources of credentials like the static passwords added by default.
OIDC
OIDC Client
The OIDC client used with thesd
CLI must have its access type set as open
and needs to have Direct Access Grants
enabled.
When using Keycloak, these settings can be configured through the client dashboard in the admin
UI.
The sd
CLI supports authentication using an standard OIDC auth flow.
At the moment, it will only work when using Keycloak as an OIDC provider.
To use it, you will need to specify the --sso
flag as well as the following
parameters:
--oidc-server
: OIDC provider endpoint.--oidc-client
: OIDC client ID.
Note that these parameters are specific to your Seldon Deploy and OIDC provider configuration.
You can see an example below:
sd list \
--server https://ml.example.org/seldon-deploy \
--user jdoe \
--password 232323 \
--sso \
--oidc-server https://ml.example.org/auth/realms/ml-realm \
--oidc-client seldon-deploy \
--namespace staging
Usage
Some of the most common workflows you can perform using sd
are deploying a
new version of your model and requesting a
promotion between environments.
These workflows can be automated as part of your CI pipeline, regardless of
your CI provider.
Deploying a Seldon model
To deploy a new version of your model you can use the sd deploy
command.
This command will take as input the filename of your SeldonDeployment
resource and will deploy it on a given namespace.
If GitOps is enabled, this will also create (or update) the relevant files in
your GitOps repository.
For example, to deploy a model named my-model
(defined in the file
my-model-seldondeployment.yaml
) in the staging
namespace you can run:
sd deploy my-model \
--server https://ml.example.org/seldon-deploy \
--user jdoe \
--password 232323 \
--namespace staging \
--filename ./my-model-seldondeployment.yaml
You can see all the supported flags in the sd deploy
reference page.
Helm
Note that this approach is compatible with using Helm to manage complex templates. This templates can encode any complex patterns relevant to your organisation and take as input an arbitrary number of variables.
As an starting point, you can consider the seldon-single-model
Helm
chart
available in Seldon Core.
Using this template, you can generate and deploy a SeldonDeployment
resource
from an image name simply as:
helm template my-model \
seldonio/seldon-single-model \
--namespace staging \
--set 'model.image=seldonio/my-model:2.0' \
> my-model-seldondeployment.yaml
sd deploy my-model \
--server https://ml.example.org/seldon-deploy \
--user jdoe \
--password 232323 \
--namespace staging \
--filename ./my-model-seldondeployment.yaml
Note that these templates can be extended to fit any custom requirement (e.g. complex graphs, service accounts, HPA, etc.).
Requesting a promotion between environments
To request a promotion of your Seldon deployment between different environments
you can use the sd promote
command.
This will fetch the latest version of your deployment from the source
environment and will create a pull request with the relevant changes on the
target environment.
Note that this workflow is only supported if GitOps is enabled.
For example, to request a promotion for a deployment named my-model
from the
staging
environment to the production
environment you can run:
sd promote my-model \
--server https://ml.example.org/seldon-deploy \
--user jdoe \
--password 232323 \
--git-user git-ci \
--git-password 242424 \
--from staging \
--to production \
--promotion-author 'Jane Doe' \
--promotion-email jdoe@example.org
You can see more details in the sd promote
reference page.