This lab runs KubeAI, vLLM and Prometheus in Minikube. Two vLLM Pods serve Qwen/Qwen3-0.6B on one NVIDIA RTX 4070 Laptop GPU. NVIDIA time-slicing exposes two schedulable slots. The two Pods share the physical device and its VRAM. Each vLLM instance targets a 0.40 GPU memory budget. NVIDIA device plugin time-slicing
Host benchmark dashboard :18081
→ benchmark target via port-forward :18080 → KubeAI router Pod → chosen vLLM Pod → physical GPU
→ nvidia-smi on the host samples utilization, VRAM and board power
The cluster router discovers the ready addresses behind kubeai-backends using EndpointSlices, then probes /v1/models and /metrics on each individual Pod. The host router has one configured destination, the forwarded cluster router. The live cluster view on port 18080 lists the vLLM Pods. The benchmark view on port 18081 runs jobs and displays the saved host results. Experiment evidence
Run the commands from the project root on a Linux host with Docker, Minikube, Python 3.11+, an NVIDIA driver and a working NVIDIA Container Toolkit. Use a GPU with enough free VRAM for both instances and allow disk space for the vLLM image, model and cache. On this lab machine, the unpacked image occupied about 32 GB in Docker. Check nvidia-smi for existing workloads, including any standalone Compose vLLM instance, before starting the GPU Pods.
nvidia-smi
minikube start -p kubeai-lab --driver=docker --container-runtime=docker --gpus=all
labctl() { minikube -p kubeai-lab kubectl -- "$@"; }
labctl get nodes
labctl get node kubeai-lab -o jsonpath='{.status.allocatable.nvidia\.com/gpu}{"\n"}'
A fresh cluster with one GPU should show a Ready node and 1 GPU before sharing. If the GPU field is empty, check the Docker runtime and the NVIDIA device plugin before deploying vLLM. Use -p kubeai-lab to select this profile. Minikube GPU setup
VLLM_IMAGE='vllm/vllm-openai@sha256:c1c9f6fd5c109ba7f0546a59f5b2f15fb87f64c77782e90a27b648b42a8e67c3'
MODEL_REVISION='c1899de289a04d12100db370d81485cdf75e47ca'
docker build -t kubeai:local .
docker image inspect "$VLLM_IMAGE" >/dev/null 2>&1 || docker pull "$VLLM_IMAGE"
docker tag "$VLLM_IMAGE" vllm-local:pinned-c1c9f6fd
minikube -p kubeai-lab image load --daemon kubeai:local
minikube -p kubeai-lab image load --daemon vllm-local:pinned-c1c9f6fd
minikube -p kubeai-lab image ls | grep -E 'kubeai:local|vllm-local:pinned-c1c9f6fd'
The vLLM manifest uses the loaded tag with imagePullPolicy: Never. The pinned Qwen revision comes from Hugging Face on first start. The kubeai-model-cache PVC stores it across Pod restarts and minikube stop. Model download and CUDA initialization can take several minutes on an empty cache. Minikube image loading · Serving manifest
Apply this configuration when the allocatable GPU count is 1. The plugin configuration is a cluster object scoped to kubeai-lab. On an existing deployment, release the previous GPU allocation before changing the plugin. For a fresh cluster, proceed directly to the ConfigMap block.
labctl() { minikube -p kubeai-lab kubectl -- "$@"; }
labctl -n kubeai scale deployment/kubeai-emulator --replicas=0
labctl -n kubeai wait --for=delete pod -l app=kubeai-backend --timeout=90s
labctl() { minikube -p kubeai-lab kubectl -- "$@"; }
labctl apply -f - <<'YAML'
apiVersion: v1
kind: ConfigMap
metadata:
name: kubeai-gpu-sharing
namespace: kube-system
data:
config.yaml: |
version: v1
sharing:
timeSlicing:
failRequestsGreaterThanOne: true
resources:
- name: nvidia.com/gpu
replicas: 2
YAML
PLUGIN_CONTAINER=$(labctl -n kube-system get daemonset nvidia-device-plugin-daemonset \
-o jsonpath='{.spec.template.spec.containers[0].name}')
labctl -n kube-system patch daemonset nvidia-device-plugin-daemonset \
--type=strategic --patch "$(cat <<YAML
spec:
template:
spec:
containers:
- name: ${PLUGIN_CONTAINER}
env:
- name: CONFIG_FILE
value: /etc/kubeai-gpu/config.yaml
volumeMounts:
- name: kubeai-gpu-sharing
mountPath: /etc/kubeai-gpu
readOnly: true
volumes:
- name: kubeai-gpu-sharing
configMap:
name: kubeai-gpu-sharing
YAML
)"
labctl -n kube-system rollout status daemonset/nvidia-device-plugin-daemonset --timeout=2m
labctl get node kubeai-lab -o jsonpath='{.status.allocatable.nvidia\.com/gpu}{"\n"}'
Wait for the allocatable count to show 2 before starting both vLLM Pods. Each Pod requests nvidia.com/gpu: 1. NVIDIA configuration-file options
For the first start on an empty model cache, set spec.replicas: 1 temporarily in replicas.yaml. Apply the manifests and wait for the first vLLM Pod to be ready. Then set spec.replicas: 2 and repeat the block. This stages the model download and GPU startup. The Deployment name kubeai-emulator is historical. Its container and image identify the vLLM server.
labctl apply -k deploy/kubernetes
labctl -n kubeai rollout status deployment/kubeai-emulator --timeout=10m
labctl -n kubeai rollout status deployment/kubeai-router --timeout=2m
labctl -n kubeai get pods -o wide
labctl -n kubeai get endpointslices -l kubernetes.io/service-name=kubeai-backends
Once both vLLM Pods show 1/1 Running, open the dashboards. Prometheus scrapes replica metrics through the headless kubeai-metrics Service and persists its database in a PVC. Prometheus scrape config
Terminal 1 forwards the cluster router. Leave this terminal open throughout a run.
minikube -p kubeai-lab kubectl -- -n kubeai \
port-forward service/kubeai-router 18080:8080
Open the cluster dashboard and check that both vLLM Pods appear as healthy. Pod IPs can change on restart. From another terminal, verify the available model.
curl -fsS http://127.0.0.1:18080/v1/models
Terminal 2 runs the benchmark dashboard on the GPU host. Create its config once from the supplied single-vLLM config.
python3 - <<'PY'
import json
from pathlib import Path
config_path = Path('results/k8s-vllm/router.json')
if not config_path.exists():
config = json.loads(Path('config/vllm.json').read_text())
config['replicas'][0].update(name='minikube-router', url='http://127.0.0.1:18080')
config_path.parent.mkdir(parents=True, exist_ok=True)
config_path.write_text(json.dumps(config, indent=2) + '\n')
PY
python3 -m kubeai router --config results/k8s-vllm/router.json \
--results results/k8s-vllm --host 127.0.0.1 --port 18081 \
--benchmark-target http://127.0.0.1:18080 --scale-minikube-profile kubeai-lab
Open the benchmark dashboard. The replica fleet and benchmark form show the measured cluster backends when --benchmark-target is configured. Jobs send traffic directly to 18080 and record the selected vLLM Pod. If the cluster router requires a key, supply it through KUBEAI_BENCHMARK_TARGET_API_KEY on the benchmark host. Dashboard job eligibility
Under Replica fleet, use − Replica or + Replica to request one or two Pods. The host dashboard sends a kubectl scale request for deployment/kubeai-emulator in namespace kubeai on the selected Minikube profile. Keep the panel open to see the ready and requested counts. A benchmark can begin when the requested rollout is ready and the cluster router has discovered that count. Replica controls are locked while a benchmark runs. Kubernetes kubectl scale
The buttons change the live Deployment count. The manifest controls model settings and the declared replica count used by a later apply -k. To target a renamed vLLM Deployment in the namespace, pass --scale-deployment DEPLOYMENT_NAME when starting the host dashboard.
18080.18081, choose Hardware, Qwen/Qwen3-0.6B, and Closed-loop workers. The existing Minikube baseline used 4 workers, 30 seconds, seed 42 and 2 warm-up requests.results/k8s-vllm/dashboard-benchmarks/.Board-power and energy figures cover the whole physical GPU. Benchmarks with --benchmark-target include the port-forward in the latency path. Earlier host-dashboard runs used the extra local relay and recorded minikube-router as their endpoint. To inspect new per-Pod activity, open Recorded runs → Inspect → Requests by replica.
The capacity experiment asks when a second replica helps on the GPU already available. Use one cluster policy throughout. The example uses kubeai. The lab manifest uses --gpu-memory-utilization "0.40" per Pod. Select − Replica if two Pods are active, then wait for one ready and discovered Pod. The recorded 1 × 0.75 dashboard baseline used closed-loop traffic. This experiment starts at 1 × 0.40 and uses fixed arrival times.
In the benchmark dashboard, choose Capacity sweep. Enter ascending offered rates such as 5, 10, 15, 20, seconds per rate, the number of repeats and your service targets. Declare 0.40 as the per-replica VRAM fraction for this configuration. A point meets its targets when every repeat achieves the required share of on-time completions and stays within the error limit. On-time completion requires both the first token and the full response before their deadlines, measured from the scheduled arrival. Failures, drops and late completions count against the on-time share. Open Capacity and scale-out to see the highest tested pass and the first tested miss. After the benchmark finishes, use + Replica, wait for two ready Pods and repeat with the same settings.
minikube -p kubeai-lab kubectl -- -n kubeai scale deployment/kubeai-emulator --replicas=1
minikube -p kubeai-lab kubectl -- -n kubeai \
rollout status deployment/kubeai-emulator --timeout=5m
curl -fsS http://127.0.0.1:18080/api/state | python3 -m json.tool
For a CLI replay or a burst experiment, use a saved trace so both configurations receive the same requests at the same scheduled times. This command creates a pilot trace. Use new filenames for other offered rates, burst traces or seeds. Replay every chosen file in every configuration.
CAPACITY_TRACE=results/k8s-vllm/workloads/steady-r20-seed42.jsonl
python3 -m kubeai trace --output "$CAPACITY_TRACE" \
--requests 600 --rate 20 --scenario steady --seed 42
CAPACITY_VARIANT=1x040
python3 -m kubeai benchmark --url http://127.0.0.1:18080 \
--trace "$CAPACITY_TRACE" --environment hardware --policy kubeai --gpu --warmup 2 \
--model-revision c1899de289a04d12100db370d81485cdf75e47ca \
--image-digest vllm/vllm-openai@sha256:c1c9f6fd5c109ba7f0546a59f5b2f15fb87f64c77782e90a27b648b42a8e67c3 \
--output "results/k8s-vllm/capacity/$CAPACITY_VARIANT"
Set spec.replicas: 2, reapply, and confirm two healthy vLLM Pods. Replay the same trace with CAPACITY_VARIANT=2x040. Match the model, request path, client limits and per-replica warm-up. If 1 × 0.80 is stable, run a third configuration to compare one instance with two at the same nominal total VRAM budget. Return to one ready Pod before rolling out a different memory budget. 0.40 and 0.80 are vLLM VRAM settings. Both Pod setups measure power on the same physical board.
Set latency and reliability targets before the comparison. Repeat runs and inspect requests.csv and summary.json. Use scheduled TTFT and scheduled end-to-end latency to calculate requests completed within target per second. Report P95, errors, drops, token-limited outputs and energy per unit of work. Record the live vLLM flags and Pod count with each set of runs. Acceptance criteria
After the steady-configuration runs, use a separate rising-load replay to measure manual scale-out. Record the time when the second Pod is requested and when it becomes ready, then inspect delays and failures during that interval. Treat this run as a transition experiment with a changing Pod set.
Keep two ready vLLM Pods at 0.40 each and replay the same traces for all policies. Set the top-level policy in router.json to round_robin, capacity or kubeai. Apply the Kustomization between runs and verify the new policy through the cluster API before sending traffic. ConfigMap projection may take time.
minikube -p kubeai-lab kubectl -- apply -k deploy/kubernetes
curl -fsS http://127.0.0.1:18080/api/state \
| python3 -c 'import json, sys; print(json.load(sys.stdin)["policy"])'
With --benchmark-target, the form follows the cluster’s active policy. Run the same sweep after each cluster policy change and select the matching workload under Capacity and scale-out to compare curves. The CLI command below can also replay a saved trace and retain the selected Pod in the request CSV. Use the policy verified above and the pinned provenance values.
CAPACITY_TRACE=results/k8s-vllm/workloads/steady-r20-seed42.jsonl
python3 -m kubeai benchmark --url http://127.0.0.1:18080 \
--trace "$CAPACITY_TRACE" --environment hardware --policy kubeai --gpu --warmup 2 \
--model-revision c1899de289a04d12100db370d81485cdf75e47ca \
--image-digest vllm/vllm-openai@sha256:c1c9f6fd5c109ba7f0546a59f5b2f15fb87f64c77782e90a27b648b42a8e67c3 \
--output results/k8s-vllm/routing
For controlled comparisons, record the actual cluster policy, Pod set, vLLM flags and workload each time. Keep the same request path across runs. The dashboard checks target snapshots before, during and after each run and excludes sweeps with detected routing or fleet changes from grouped results. The CLI artifacts remain available for analysis. Measurement rules
Wait for a benchmark to finish, then press Ctrl+C in the host benchmark-router and port-forward terminals. Stop this profile with the following command. The cluster data and volumes stay on disk, and the benchmark artifacts stay under results/k8s-vllm/. Minikube stop
minikube stop -p kubeai-lab
After a shutdown, start the same profile and check its GPU slots and Pods.
minikube start -p kubeai-lab
minikube -p kubeai-lab kubectl -- get node kubeai-lab \
-o jsonpath='{.status.allocatable.nvidia\.com/gpu}{"\n"}'
minikube -p kubeai-lab kubectl -- -n kubeai get pods -o wide
For the two-replica lab, the expected result is 2 allocatable slots and two ready vLLM Pods. If the count has returned to 1, restore GPU sharing and reapply the manifests. If the profile was deleted or recreated, use first setup to build and deploy the lab again.
When the Pods are ready, reopen the port-forward in terminal 1.
minikube -p kubeai-lab kubectl -- -n kubeai \
port-forward service/kubeai-router 18080:8080
From the project root in terminal 2, reopen the benchmark dashboard with the existing config and results.
python3 -m kubeai router --config results/k8s-vllm/router.json \
--results results/k8s-vllm --host 127.0.0.1 --port 18081 \
--benchmark-target http://127.0.0.1:18080 --scale-minikube-profile kubeai-lab
| Symptom | Check |
|---|---|
failed to download openapi or no route to host |
Verify minikube status -p kubeai-lab and use -p kubeai-lab on the Kubernetes commands. |
ErrImageNeverPull |
Load the local vLLM tag into kubeai-lab and confirm it appears in minikube -p kubeai-lab image ls. |
Second Pod is Pending |
Run labctl -n kubeai describe pod POD_NAME and check for Insufficient nvidia.com/gpu. Verify two allocatable slots. |
vLLM is in CrashLoopBackOff |
Run labctl -n kubeai logs POD_NAME -c vllm --previous --tail=100. Check the model cache mount, available GPU memory and the first startup error. |
18081 shows a single endpoint |
Check the live Pod entries on 18080 and verify /api/state on that port. |
The placement CLI can separately generate a Pod from a fresh node/GPU inventory. That workflow recommends a location and leaves deployment to the operator. Placement examples