|
| 1 | +# CLI |
| 2 | + |
| 3 | +Seldon provides a CLI to allow easy management and testing of Model, Experiment, and Pipeline resources. |
| 4 | + |
| 5 | +At present this needs to be built by hand from the operator folder. |
| 6 | + |
| 7 | +``` |
| 8 | +make build-seldon # for linux/macOS amd64 |
| 9 | +make build-seldon-arm # for macOS ARM |
| 10 | +``` |
| 11 | + |
| 12 | +Then place the `bin/seldon` executable in your path. |
| 13 | + |
| 14 | + * [cli docs](./docs/seldon.md) |
| 15 | + |
| 16 | + |
| 17 | +## Environment Variables and Services |
| 18 | + |
| 19 | +The CLI talks to 3 backend services on default endpoints: |
| 20 | + |
| 21 | + 1. The Seldon Core 2 Scheduler: default 0.0.0.0:9004 |
| 22 | + 2. The Seldon Core inference endpoint: default 0.0.0.0:9000 |
| 23 | + 3. The Seldon Kafka broker: default: 0.0.0.0:9092 |
| 24 | + |
| 25 | +These defaults will be correct when Seldon Core 2 is installed locally as per the docs. For Kubernetes, you will need to change these by defining environment variables. |
| 26 | + |
| 27 | +```{literalinclude} ../../../../operator/cmd/seldon/cli/flags.go |
| 28 | +:language: golang |
| 29 | +:start-after: // Defaults |
| 30 | +:end-before: // Help statements |
| 31 | +``` |
| 32 | + |
| 33 | +## Kubernetes Usage |
| 34 | + |
| 35 | +### Inference Service |
| 36 | + |
| 37 | +For a default install into the `seldon-mesh` namespace if you have exposed the inference `svc` as a loadbalancer you will find it at: |
| 38 | + |
| 39 | +``` |
| 40 | +kubectl get svc seldon-mesh -n seldon-mesh -o jsonpath='{.status.loadBalancer.ingress[0].ip}' |
| 41 | +``` |
| 42 | + |
| 43 | +Use above IP at port 80: |
| 44 | + |
| 45 | +``` |
| 46 | +export SELDON_INFER_HOST=<ip>:80 |
| 47 | +``` |
| 48 | + |
| 49 | +### Scheduler Service |
| 50 | + |
| 51 | +For a default install into the `seldon-mesh` namespace if you have exposed the scheduler svc as a loadbalancer you will find it at: |
| 52 | + |
| 53 | +``` |
| 54 | +kubectl get svc seldon-scheduler -n seldon-mesh -o jsonpath='{.status.loadBalancer.ingress[0].ip}' |
| 55 | +``` |
| 56 | + |
| 57 | +Use above IP at port 9004: |
| 58 | + |
| 59 | +``` |
| 60 | +export SELDON_SCHEDULE_HOST=<ip>:9004 |
| 61 | +``` |
| 62 | + |
| 63 | +### Kafka Broker |
| 64 | + |
| 65 | +The Kafka broker will depend on how you have installed Kafka into your Kubernetes cluster. Find the broker IP and use: |
| 66 | + |
| 67 | +``` |
| 68 | +export SELDON_KAFKA_BROKER=<ip>:<port> |
| 69 | +``` |
| 70 | + |
| 71 | +## Config file |
| 72 | + |
| 73 | +You can create a config file to manage connections to running Seldon Core 2 installs. The settings will override any environment variable settings. |
| 74 | + |
| 75 | +The definition is shown below: |
| 76 | + |
| 77 | + ```{literalinclude} ../../../../operator/pkg/cli/config.go |
| 78 | + :language: golang |
| 79 | + :start-after: // start config struct |
| 80 | + :end-before: // end config struct |
| 81 | + ``` |
| 82 | + |
| 83 | +An example below shows an example where we connect via TLS to the Seldon scheduler using our scheduler client certificate: |
| 84 | + |
| 85 | +``` |
| 86 | +{ |
| 87 | + "controlplane":{ |
| 88 | + "schedulerHost": "seldon-scheduler.svc:9044", |
| 89 | + "tls"; true, |
| 90 | + "keyPath": "/home/certs/seldon-scheduler-client/tls.key", |
| 91 | + "crtPath": "/home/certs/seldon-scheduler-client/tls.crt", |
| 92 | + "caPath": "/home/certs/seldon-scheduler-client/ca.crt" |
| 93 | + } |
| 94 | +} |
| 95 | +
|
| 96 | +``` |
| 97 | + |
| 98 | +To manage config files and activate them you can use the CLI command `seldon config` which has subcommands to list, add, remove, activate and decative configs. |
| 99 | + |
| 100 | +For example: |
| 101 | + |
| 102 | +``` |
| 103 | +$ seldon config list |
| 104 | +config path active |
| 105 | +------ ---- ------ |
| 106 | +kind-sasl /home/work/seldon/cli/config-sasl.json * |
| 107 | +
|
| 108 | +$ seldon config deactivate kind-sasl |
| 109 | +
|
| 110 | +$ seldon config list |
| 111 | +config path active |
| 112 | +------ ---- ------ |
| 113 | +kind-sasl /home/work/seldon/cli/config-sasl.json |
| 114 | +
|
| 115 | +$ seldon config add gcp-scv2 ~/seldon/cli/gcp.json |
| 116 | +
|
| 117 | +$ seldon config list |
| 118 | +config path active |
| 119 | +------ ---- ------ |
| 120 | +gcp-scv2 /home/work/seldon/cli/gcp.json |
| 121 | +kind-sasl /home/work/seldon/cli/config-sasl.json |
| 122 | +
|
| 123 | +$ seldon config activate gcp-scv2 |
| 124 | +
|
| 125 | +$ seldon config list |
| 126 | +config path active |
| 127 | +------ ---- ------ |
| 128 | +gcp-scv2 /home/work/seldon/cli/gcp.json * |
| 129 | +kind-sasl /home/work/seldon/cli/config-sasl.json |
| 130 | +
|
| 131 | +$ seldon config list kind-sasl |
| 132 | +{ |
| 133 | + "controlplane": { |
| 134 | + "schedulerHost": "172.19.255.2:9004" |
| 135 | + }, |
| 136 | + "kafka": { |
| 137 | + "bootstrap": "172.19.255.3:9093", |
| 138 | + "caPath": "/home/work/gcp/scv2/certs/seldon-cluster-ca-cert/ca.crt" |
| 139 | + } |
| 140 | +} |
| 141 | +``` |
| 142 | + |
| 143 | +## TLS Certificates for Local Use |
| 144 | + |
| 145 | +For running with Kubernetes TLS connections on the control and/or data plane, certificates will need to be downloaded locally. We provide an example script which will download certificates from a Kubernetes secret and store them in a folder. It can be found in `hack/download-k8s-certs.sh` and takes 2 or 3 arguments: |
| 146 | + |
| 147 | +``` |
| 148 | +./download-k8s-certs.sh <namespace> <secret> [<folder>] |
| 149 | +``` |
| 150 | + |
| 151 | +e.g.: |
| 152 | + |
| 153 | +``` |
| 154 | +./download-k8s-certs.sh seldon-mesh seldon-scheduler-client |
| 155 | +``` |
0 commit comments