Serve a model from Model Registry with KServe

This article explains how to validate model serving with KServe when public access may be affected by Single Sign-On (SSO) or DNS resolution issues. It shows how to deploy an InferenceService, test inference through the public URL, distinguish between SSO and DNS problems, and apply workarounds when needed.

Overview

This procedure is intended to answer two practical questions:

  • does the InferenceService start correctly and reach Ready=True,

  • does inference work through the public URL.

If the public URL does not work directly, the procedure helps determine whether the problem is caused by:

  • SSO or authentication on the ingress path,

  • DNS resolution on the client side,

  • routing, firewall, VPN, or load balancer issues.

The article also includes a direct-to-pod test that bypasses ingress and authentication so that you can verify whether the model itself is serving correctly.

Prerequisites

Before starting, make sure that:

  1. You have access to a Kubernetes cluster with KServe enabled.

  2. You can use kubectl against the target cluster.

  3. Your namespace is available and you have permission to create an InferenceService in it.

  4. The cluster has access to the example storage location used in the manifest.

  5. You can run curl, and preferably also dig or nslookup, on your local machine.

Namespace variable

This procedure uses the variable NS throughout.

Set it to your namespace before starting:

export NS=<your_namespace>

What this test verifies

The goal is to verify:

  • that the InferenceService starts correctly and reaches Ready=True,

  • that inference works through the public URL when possible,

  • and, if that is not possible, whether the failure is caused by SSO, DNS, or infrastructure routing.

Step 0. Optional cleanup of stale pods

This cleanup is optional but useful if your namespace contains old Evicted or Completed pods.

Check the current pods:

kubectl -n "$NS" get pods -o wide

Delete evicted pods:

kubectl -n "$NS" get pods --no-headers | awk '$3=="Evicted"{print $1}' | xargs -r kubectl -n "$NS" delete pod

Delete completed pods:

kubectl -n "$NS" get pods --no-headers | awk '$3=="Completed"{print $1}' | xargs -r kubectl -n "$NS" delete pod

This step is safe and only removes pods that are no longer active.

Step 1. Create the inference payload

Create a small JSON payload for the test request:

cat > iris-input.json <<'EOF'
{
  "instances": [
    [6.8, 2.8, 4.8, 1.4],
    [6.0, 3.4, 4.5, 1.6]
  ]
}
EOF

This file will be used in later curl requests.

Step 2. Deploy the InferenceService

Apply the following manifest:

kubectl -n "$NS" apply -f - <<'EOF'
apiVersion: "serving.kserve.io/v1beta1"
kind: "InferenceService"
metadata:
  name: "sklearn-iris"
spec:
  predictor:
    model:
      modelFormat:
        name: sklearn
      storageUri: "gs://kfserving-examples/models/sklearn/1.0/model"
      resources:
        requests:
          cpu: "100m"
          memory: "512Mi"
        limits:
          cpu: "1"
          memory: "1Gi"
EOF

This creates an example InferenceService named sklearn-iris.

Step 3. Wait for readiness and collect diagnostics

Wait for the service to become ready:

kubectl -n "$NS" wait --for=condition=Ready inferenceservice/sklearn-iris --timeout=10m

Then check the related resources:

kubectl -n "$NS" get isvc,ksvc,rev,pods -o wide

And inspect recent events:

kubectl -n "$NS" get events --sort-by=.lastTimestamp | tail -n 30

Expected result

The InferenceService should reach Ready=True.

If it does not, the output from get and events should help identify whether the problem is related to scheduling, image pulls, revision failures, or networking.

Step 4. Public test and SSO versus DNS detection

Retrieve the public service URL and host

Run:

SERVICE_URL="$(kubectl -n "$NS" get isvc sklearn-iris -o jsonpath='{.status.url}')"
SERVICE_HOST="$(echo "$SERVICE_URL" | cut -d/ -f3)"
echo "SERVICE_URL=$SERVICE_URL"
echo "SERVICE_HOST=$SERVICE_HOST"

This gives you the URL exposed by KServe and the hostname part that will be used in later checks.

Check DNS from your laptop

Run one of the following:

dig +short "$SERVICE_HOST" || nslookup "$SERVICE_HOST" || getent hosts "$SERVICE_HOST"

This checks whether your local machine can resolve the public hostname.

Send an inference request through the public URL

Run:

curl -skvL -H "Content-Type: application/json" \
"${SERVICE_URL}/v1/models/sklearn-iris:predict" -d @iris-input.json \
-w "\nHTTP %{http_code}\n"

Interpretation

Interpret the result as follows:

  • HTTP 200 with predictions The public path works correctly and there is no SSO blocking this route.

  • HTTP 302 with a redirect to something like /oauth2/…, or HTTP 403 with an HTML login page The ingress path is protected by SSO or another authentication layer.

  • Could not resolve host This is a DNS issue on the client side.

  • DNS works, but curl returns HTTP 000 or timeout This points to a routing, firewall, VPN, or other infrastructure issue.

If you have a DNS problem, or you want to test the normal ingress path without relying on DNS, continue to the next step.

Step 5. DNS workaround with –resolve

This method bypasses local DNS by forcing a hostname-to-IP mapping in curl. It still tests the normal ingress path through the Istio load balancer.

Get the public Istio ingress gateway IP

Run:

GW_IP="$(kubectl get svc -n istio-system istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null)"
[ -n "$GW_IP" ] || GW_IP="$(kubectl get svc -A -l app=istio-ingressgateway -o jsonpath='{.items[0].status.loadBalancer.ingress[0].ip}' 2>/dev/null)"
echo "GW_IP=$GW_IP"
kubectl get svc -A -l app=istio-ingressgateway -o wide

Determine the port based on the URL

Run:

if echo "$SERVICE_URL" | grep -q '^https://'; then PORT=443; else PORT=80; fi
echo "PORT=$PORT"

Send the request through ingress with –resolve

Run:

curl -skvL --resolve "${SERVICE_HOST}:${PORT}:${GW_IP}" \
-H "Content-Type: application/json" \
"${SERVICE_URL}/v1/models/sklearn-iris:predict" -d @iris-input.json \
-w "\nHTTP %{http_code}\n"

Interpretation

Interpret the result as follows:

  • HTTP 200 with predictions The ingress path is working correctly. If the earlier test failed with Could not resolve host, then the issue is purely DNS on the client side.

  • HTTP 302 or 403 with login-related output The ingress path is protected by SSO or another authentication layer. DNS is not the main issue.

  • timeout or connection refused The problem is likely with the load balancer, routing, firewall, or related infrastructure.

Step 6. Direct-to-pod test to bypass ingress and authentication

This test bypasses ingress, public DNS, and SSO. It is useful when you want to confirm whether the model server itself is responding correctly.

Get the predictor pod name

Run:

POD="$(kubectl -n "$NS" get pod -l serving.knative.dev/service=sklearn-iris-predictor -o jsonpath='{.items[0].metadata.name}')"
echo "$POD"

Port-forward to the pod and test locally

Run:

kubectl -n "$NS" port-forward "pod/$POD" 18080:8080 >/tmp/pf.$$ 2>&1 & PF=$!
sleep 2
curl -skv -H "Content-Type: application/json" \
"http://127.0.0.1:18080/v1/models/sklearn-iris:predict" -d @iris-input.json \
-w "\nHTTP %{http_code}\n"
kill $PF 2>/dev/null; rm -f /tmp/pf.$$

Expected result

A successful direct-to-pod request should return HTTP 200 and prediction data.

If this succeeds while the public tests fail, the model itself is serving correctly and the problem is outside the predictor, most likely in ingress, SSO, DNS, or public routing.

Cleanup

When the test is complete, delete the InferenceService:

kubectl -n "$NS" delete inferenceservice sklearn-iris

Then verify that related resources are removed:

kubectl -n "$NS" get isvc,ksvc,rev,pods

What to do next

After completing this serving validation, the next useful steps are:

  • testing the same flow with a model actually registered in Model Registry,

  • documenting which ingress paths are protected by SSO and which are not,

  • checking public DNS visibility from different client environments,

  • confirming whether Istio ingress and external load balancer configuration are consistent across namespaces.