Sub topic 12
Monitoring and Troubleshooting a KServe Service
This chapter assumes that you understand Kubernetes pods, services, namespaces, and YAML manifests. You should also know how to apply resources with kubectl and send JSON requests with curl. The examples use a service named sklearn-iris in the default namespace.
Monitoring tells you whether a service is available, whether it responds within an acceptable time, and whether it has enough resources. Troubleshooting uses that information to find the cause of a failure.
What to monitor
KServe exposes several useful signals:
- Readiness shows whether the service can accept inference requests.
- Request rate shows how much traffic reaches the model.
- Latency measures how long requests take.
- Error rate shows failed requests, such as HTTP 4xx or 5xx responses.
- Resource usage shows CPU and memory consumption.
- Logs explain startup failures, model-loading errors, and request-processing errors.
KServe creates Kubernetes resources for the predictor. Depending on the deployment mode, these resources can include pods, services, and Knative revisions. Inspect the resources in the namespace where the InferenceService is deployed.
kubectl get inferenceservice sklearn-iris
kubectl describe inferenceservice sklearn-iris
kubectl get pods -l serving.kserve.io/inferenceservice=sklearn-iris
kubectl get svc
kubectl get events --sort-by=.lastTimestampThe InferenceService status is usually the best first check. A ready service reports a successful condition. If it is not ready, kubectl describe often shows whether the problem involves storage, a runtime, scheduling, or networking.
Follow the failure path
Use the failure path from the external request toward the model:
First test the service from inside the cluster. This separates model problems from ingress or DNS problems. If an internal request succeeds but an external request fails, inspect the ingress host, port, gateway, and request headers. If both fail, inspect the predictor pod and its logs.
POD=$(kubectl get pods \
-l serving.kserve.io/inferenceservice=sklearn-iris \
-o jsonpath='{.items[0].metadata.name}')
kubectl logs "$POD" --all-containers
kubectl describe pod "$POD"
kubectl port-forward "pod/$POD" 8080:8080
curl -H "Content-Type: application/json" \
http://127.0.0.1:8080/v1/models/sklearn-iris:predict \
-d '{"instances":[[6.8,2.8,4.8,1.4]]}'The exact container port and local endpoint can vary by runtime. Check the pod specification when port forwarding does not work.
Common symptoms and causes
| Symptom | Likely cause | First check |
|---|---|---|
| Service is not ready | Model download or runtime startup failure | InferenceService conditions and pod logs |
| Pod restarts repeatedly | Invalid configuration or out-of-memory failure | `kubectl describe pod` and previous logs |
| Requests return 404 | Incorrect protocol path or model name | Runtime protocol and request URL |
| Requests time out | Slow model, insufficient resources, or ingress limit | Latency metrics and pod resources |
| No pods run | Scheduling, quota, or node-capacity problem | Events and pod status |
A practical troubleshooting order
- Confirm the namespace and resource name.
- Check the InferenceService status.
- Inspect events for scheduling and admission errors.
- Inspect predictor logs, including logs from a previous container instance.
- Test the endpoint inside the cluster.
- Check ingress and protocol details.
- Compare latency and resource usage with configured limits.
- Reproduce the smallest failing request before changing the deployment.
Exercise
The InferenceService reports ready, but a request returns HTTP 404. What should you check first?
Show answer
Check that the URL uses the protocol expected by the runtime, that the model name matches the InferenceService name, and that the request path is correct for V1 or V2.