← All cheatsheets
$ kubectl get inferenceservices -ADeploy and inspect InferenceServices, send prediction requests, roll out canaries and serve LLMs on Kubernetes with KServe.
Inspect
kubectl get inferenceservices -AList models and their URLs (short name: isvc)kubectl describe isvc sklearn-iris -n modelsCheck readiness and eventskubectl get isvc sklearn-iris -n models -o jsonpath="{.status.url}"Get the model URLkubectl get servingruntimes,clusterservingruntimes -AList available model runtimeskubectl logs -n models -l serving.kserve.io/inferenceservice=sklearn-iris -c kserve-containerRead model server logskubectl get inferencegraphs -AList inference pipelinesCall a model
SERVICE_HOSTNAME=$(kubectl get isvc sklearn-iris -n models -o jsonpath="{.status.url}" | cut -d/ -f3)Get the host namecurl -H "Host: ${SERVICE_HOSTNAME}" -H "Content-Type: application/json" http://${INGRESS_HOST}:${INGRESS_PORT}/v1/models/sklearn-iris:predict -d @./iris-input.jsonSend a V1 prediction requestkubectl patch isvc sklearn-iris -n models --type merge -p '{"spec":{"predictor":{"canaryTrafficPercent":10}}}'Send 10 percent of traffic to the new revisionScikit-learn model with scale to zero
apiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
name: sklearn-iris
namespace: models
spec:
predictor:
minReplicas: 0
model:
modelFormat:
name: sklearn
storageUri: gs://kfserving-examples/models/sklearn/1.0/modelLLM with the Hugging Face runtime
apiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
name: llama3
namespace: models
spec:
predictor:
model:
modelFormat:
name: huggingface
args:
- --model_name=llama3
- --model_id=meta-llama/Meta-Llama-3-8B-Instruct
resources:
limits:
nvidia.com/gpu: "1"