Skip to main content
In this lesson you’ll deploy the Qwen model to a Kubernetes cluster using KServe and call it via an OpenAI-compatible endpoint. The walkthrough covers creating the namespace, applying the InferenceService manifest, waiting for the model to become READY, port-forwarding the predictor service to your workstation, and sending a chat completion request.
A presentation slide titled "Demo: Deploying and Calling the Qwen Model." The right side has a dark curved panel with a line-art rocket launching from a laptop.
Quick flow for the lab
  1. Create namespace kserve-inference.
  2. Inspect the InferenceService manifest (qwen-model.yaml) for the Qwen model.
  3. Apply the manifest to create the InferenceService.
  4. Wait until the InferenceService reports READY=true.
  5. Port-forward the predictor service to your local machine.
  6. Send an OpenAI-compatible chat completion request and inspect the response.
Prerequisite — verify your cluster
Example output:
Create the namespace
Example output:
Inspect the InferenceService manifest The qwen-model.yaml creates an InferenceService named qwen-model in the kserve-inference namespace and configures a Hugging Face–format model. The manifest below shows the predictor configuration, storage URI, and resource requests/limits.
Apply the manifest
Example output:
Watch the InferenceService status Wait until KServe finishes creating the InferenceService and the model is ready. Use the -w (watch) flag to observe status changes in real time:
Trimmed example progression:
Wait until READY reports True before attempting to connect. Trying earlier can yield connection errors or model-startup failures.
Confirm the predictor service Once READY=true, confirm the predictor service exists — this is the service you’ll port-forward to:
Example output:
Port-forward the predictor service Create a local tunnel from your workstation to the predictor service. Run this in the background so it stays open while you send requests:
Example shell output:
Port 8080 on your workstation now forwards to port 80 on the predictor service inside the cluster. Send a chat completion request (OpenAI-compatible) Use the OpenAI-compatible Chat Completions endpoint exposed by KServe. This request follows the OpenAI Chat Completions schema and targets the local port-forward.
Note: while the model is generating, the curl command may appear to hang briefly — this is expected while tokens are produced. Example (trimmed) JSON response:
Response highlights
  • The assistant reply is located at choices[0].message.content.
  • The usage block contains token counts (useful for tracking cost and quotas).
Quick commands reference Lab checklist
  • Verify the Qwen InferenceService reports READY=true in the kserve-inference namespace.
  • Start a port-forward to the qwen-model-predictor service (local 8080 -> service 80).
  • Send the curl request to http://localhost:8080/openai/v1/chat/completions as shown above.
  • Inspect choices[0].message.content to read the model’s reply.
Links and references

Watch Video

Practice Lab