Command Line Interface
sdcommand line interface is considered experimental. The following commands could change at any time and breaking changes are expected.
sd command line interface allows you to access Seldon Deploy
This allows you to trigger deployments and promotions directly from your
training or CI pipelines.
To use it, you can run the pre-built
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
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
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 ClientThe OIDC client used with the
sdCLI must have its access type set as
openand needs to have
Direct Access Grantsenabled. When using Keycloak, these settings can be configured through the client dashboard in the admin UI.
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
--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
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
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.
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
available in Seldon Core.
Using this template, you can generate and deploy a
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
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 email@example.com
You can see more details in the
sd promote reference page.