Model deploy

From RHEcosystemAppEng/agentic-plugins · View interactive version

Model deploy is an AI agent skill from the GitHub repository RHEcosystemAppEng/agentic-plugins. Deploy AI/ML models on OpenShift AI using KServe with vLLM, NVIDIA NIM, or Caikit+TGIS runtimes. Use when: - "Deploy Llama 3 on my cluster" - "Set up a vLLM inference endpoint" - "Deploy a model with NIM" - "Create an InferenceService for Granite" - "I need to serve a model on OpenShift AI" Handles

How to use this skill

Skill file

/model-deploy Skill

Deploy AI/ML models on Red Hat OpenShift AI using KServe. Supports vLLM, NVIDIA NIM, and Caikit+TGIS serving runtimes. Handles runtime selection, hardware profile lookup (with live doc fallback), GPU pre-flight checks, InferenceService CR creation, rollout monitoring, and post-deployment validation.

Prerequisites

Required MCP Server: openshift (OpenShift MCP Server)

Required MCP Tools (from openshift):

Preferred MCP Server: rhoai (RHOAI MCP Server) — used when available, automatic OpenShift fallback on failure

Preferred MCP Tools (from rhoai):

Optional MCP Server: ai-observability (AI Observability MCP)

Optional MCP Tools (from ai-observability):

Common prerequisites (KUBECONFIG, OpenShift+RHOAI cluster, KServe, verification protocol): See skill-conventions.md.

Fallback templates: See openshift-fallback-templates.md for OpenShift YAML templates used when RHOAI tools are unavailable.

Additional cluster requirements:

When to Use This Skill

Use this skill when you need to:

Do NOT use this skill when:

Workflow

Step 1: Gather Target and Validate Environment

Collect the deployment target from the user, then immediately validate the environment before gathering remaining details.

Ask the user for:

Pre-flight Environment Validation:

CRITICAL: Run these checks BEFORE gathering remaining deployment details to avoid wasted configuration effort.

Read model-deploy-preflight-checklist.md for the full pre-flight protocol. The checklist validates:

If rhoai unavailable or returns error: Use resources_list (from openshift) with apiVersion: v1, kind: Namespace, labelSelector: opendatahub.io/dashboard=true to find RHOAI projects.

Present pre-flight results in a summary table and note any adjustments made. WAIT for user confirmation if significant changes were needed (e.g., deployment mode switch, resource adjustments, tolerations added).

Step 2: Gather Deployment Details

After the environment is validated, collect remaining deployment configuration. Use pre-flight findings to inform defaults (e.g., if Knative is unavailable, default to RawDeployment).

Ask the user for:

Present configuration table for review:

| Setting | Value | Source |

|---------|-------|--------|

| Model | [model-name] | user input (Step 1) |

| Runtime | [to be determined in Step 3] | auto-detect / user input |

| Namespace | [namespace] | user input (Step 1) |

| Model Source | [source-uri] | user input |

| Deployment Mode | [Serverless/RawDeployment] | user input / default (informed by pre-flight) |

WAIT for user to confirm or modify these settings.

Step 3: Determine Runtime

Document Consultation (read before selecting runtime):

  1. Action: Read supported-runtimes.md using the Read tool to understand runtime capabilities and selection criteria
  2. Output to user: "I consulted supported-runtimes.md to understand runtime capabilities."

Runtime Selection Logic:

Present recommendation with rationale. WAIT for user confirmation.

Step 4: Look Up Model Hardware Profile

Document Consultation (read before determining hardware requirements):

  1. Action: Read known-model-profiles.md using the Read tool to find hardware profile for the requested model
  2. Output to user: "I consulted known-model-profiles.md to find hardware requirements for [model-name]."

If model IS in known-model-profiles.md:

If model is NOT in known-model-profiles.md -> Trigger live doc lookup:

  1. Action: Read live-doc-lookup.md using the Read tool for the lookup protocol
  2. Output to user: "Model [model-name] is not in my cached profiles. I'll look up its hardware requirements."
  3. Use WebFetch tool to retrieve specs from:
  1. Extract: GPU requirements, model-specific args, known issues
  2. Output to user: "I looked up [model-name] on [source] to confirm its hardware requirements: [summary]"

Present hardware requirements in a table (GPUs, VRAM, Key Args).

Step 5: Pre-flight GPU Check (Optional)

Condition: Only if ai-observability MCP server is available.

MCP Tool: get_gpu_info (from ai-observability)

Compare available GPUs against model requirements from Step 4:

If ai-observability not available: Skip with note: "GPU pre-flight check skipped (ai-observability MCP not configured)."

Step 6: Verify NIM Platform (NIM Runtime Only)

Condition: Only when the selected runtime is NIM.

MCP Tool: resources_get (from openshift)

Parameters:

If Account CR not found or not ready:

Offer options: (1) Run /nim-setup now, (2) Switch to vLLM, (3) Abort. WAIT for user decision.

Step 7: Select ServingRuntime and Prepare Deployment Parameters

Verify available ServingRuntimes:

MCP Tool: list_serving_runtimes (from rhoai)

Parameters:

The response shows existing runtimes and available templates with their supported model formats and requires_instantiation flag.

If rhoai unavailable or returns error: Use resources_list (from openshift) with apiVersion: serving.kserve.io/v1alpha1, kind: ServingRuntime, namespace: [target] to list namespace runtimes, and kind: ClusterServingRuntime for platform templates. Filter by label opendatahub.io/dashboard=true.

If the needed runtime shows requires_instantiation: true, it must first be instantiated via /serving-runtime-config or the rhoai create_serving_runtime tool.

Use the runtime list to select the correct runtime name for the deployment.

Prepare deployment parameters from Steps 1-4 and environment data from Step 1:

| Parameter | Value | Source |

|-----------|-------|--------|

| name | [model-deployment-name] | user input (DNS-compatible) |

| namespace | [namespace] | user input |

| runtime | [serving-runtime-name] | selected from list_serving_runtimes (Step 7) |

| model_format | [vLLM/pytorch/onnx/caikit/etc.] | runtime selection |

| storage_uri | [model-source-uri] | user input (prefer hf:// for public models) |

| gpu_count | [gpu-count] | from hardware profile (Step 4) |

| cpu_request | [cpu] | from profile, adjusted for LimitRange |

| memory_request | [memory] | from profile, adjusted for LimitRange |

| min_replicas | [1] | default 1 (0 for scale-to-zero) |

| max_replicas | [1] | default 1 |

Model sizing guide for LLMs:

Scale-to-zero note: Setting min_replicas=0 saves resources but introduces cold start latency (30s-2min for model loading).

Step 8: User Review and Confirmation

Display the deployment parameters table and a configuration summary to the user.

Ask: "Proceed with deploying this model? (yes/no/modify)"

WAIT for explicit confirmation.

Step 9: Deploy Model

MCP Tool: deploy_model (from rhoai)

Parameters:

Note: For NIM deployments, ensure the NGC API key secret is referenced. If deploy_model does not support NIM-specific env vars, fall back to resources_create_or_update (from openshift) with a NIM InferenceService YAML that includes spec.predictor.env referencing the ngc-api-key secretKeyRef.

GPU Toleration Handling

After deploy_model succeeds (or after creating InferenceService via OpenShift fallback), check if GPU tolerations are needed:

MCP Tool: resources_list (from openshift)

If GPU nodes have taints (check .spec.taints[]), patch the InferenceService to add matching tolerations:

MCP Tool: resources_create_or_update (from openshift)

Add tolerations to spec.predictor.tolerations matching the discovered taints. Common GPU taints include:

After patching, delete the stuck Pending pod to force rescheduling with the new tolerations.

See openshift-fallback-templates.md for the complete pattern.

NIM Deployment via OpenShift

When deploying with NIM runtime and deploy_model does not support NIM-specific env vars (NGC_API_KEY secretKeyRef, NIM_MAX_MODEL_LEN, image pull secrets):

Use resources_create_or_update (from openshift) with the NIM InferenceService template from openshift-fallback-templates.md.

Key NIM-specific fields:

Error Handling:

Step 10: Monitor Rollout

Poll InferenceService status until ready or timeout (10 minutes).

MCP Tool: get_inference_service (from rhoai)

If rhoai unavailable or returns error: Use resources_get (from openshift) with apiVersion: serving.kserve.io/v1beta1, kind: InferenceService, name: [model-name], namespace: [namespace]. Check .status.conditions for Ready=True.

Check the Ready condition and status. Repeat every 15-30 seconds until Ready=True or timeout.

Check predictor pod status:

MCP Tool: pods_list (from openshift)

Show deployment progress tracking: Pod Scheduled, Image Pulled, Container Started, Model Loaded, Ready. Include pod name, status, and restart count.

On failure: Check pod logs (pods_log) and events (events_list) for diagnostics. Present options: (1) View full pod logs, (2) Check namespace events, (3) Invoke /debug-inference, (4) Delete and retry, (5) Continue waiting. WAIT for user decision. NEVER auto-delete failed deployments.

Step 11: Deployment Complete

Get endpoint URL:

MCP Tool: get_model_endpoint (from rhoai)

If rhoai unavailable or returns error: Extract endpoint from resources_get (from openshift) on the InferenceService — the URL is in .status.url.

Report success showing: model name, runtime, namespace, GPUs, inference endpoint URL, API type (OpenAI-compatible REST), and next steps (/ai-observability, /model-monitor, /guardrails-config).

Provide test commands based on runtime:

Post-deployment validation (if ai-observability MCP available):

Common Issues

For common issues (GPU scheduling, OOMKilled, image pull errors, RBAC), see common-issues.md.

Issue 1: InferenceService Stuck in "Unknown"

Error: InferenceService status.conditions shows "Unknown" state

Cause: ServingRuntime not found in the namespace, or model serving platform not enabled.

Solution:

  1. Verify ServingRuntime exists: resources_list for servingruntimes in namespace
  2. Ensure model serving is enabled: namespace has label opendatahub.io/dashboard: "true"
  3. Check the runtime name in the InferenceService matches an available ServingRuntime
  4. If no matching runtime, use /serving-runtime-config to create one

Issue 2: Model Download Timeout

Error: Pod starts but times out while downloading model weights from S3 or OCI registry

Cause: Large model size combined with slow network connection to storage.

Solution:

  1. Add serving.knative.dev/progress-deadline annotation with a longer timeout (e.g., "1800s")
  2. Verify S3/storage credentials are valid
  3. Consider using a PVC with pre-downloaded model weights instead
  4. Check network connectivity between the pod and storage endpoint

Issue 3: LimitRange Conflicts with KServe Sidecars

Error: Pod rejected with minimum cpu usage per Container is 50m, but request is 10m or minimum memory usage per Container is 64Mi, but request is 15Mi

Cause: The namespace has a LimitRange with minimum resource constraints that exceed the hardcoded resource requests of KServe-injected sidecar containers (oauth-proxy, queue-proxy, or modelcar containers request 10m CPU / 15Mi memory). These sidecar resource values cannot be controlled through the InferenceService spec.

Solution:

  1. Check LimitRange: resources_list for LimitRange in the namespace
  2. If LimitRange minimum CPU > 10m or minimum memory > 15Mi, the LimitRange must be adjusted
  3. Options: (a) Lower LimitRange minimums to accommodate sidecars (min CPU ≤ 10m, min memory ≤ 15Mi), (b) Remove the LimitRange entirely, (c) Deploy in a different namespace without restrictive LimitRanges
  4. Prevention: Step 1 pre-flight validation now checks for this conflict before deployment

Issue 4: GPU Node Taints Prevent Scheduling

Error: Pod stuck in Pending with events showing node(s) had untolerated taint {ai-app: true} or similar custom taint messages, while also showing Insufficient nvidia.com/gpu on remaining nodes

Cause: GPU nodes are tainted with custom taints (e.g., ai-app=true:NoSchedule) to reserve them for AI workloads. The InferenceService predictor pod does not have matching tolerations, so it cannot be scheduled on GPU nodes.

Solution:

  1. Identify GPU node taints: resources_get for GPU nodes, check .spec.taints
  2. Add matching tolerations to the InferenceService predictor spec:

```yaml

spec:

predictor:

tolerations:

operator: "Equal"

value: "true"

effect: "NoSchedule"

```

  1. Prevention: Step 1 pre-flight validation now auto-discovers GPU node taints and generates tolerations

Issue: Pod Stuck Pending Due to GPU Node Taints

Error: Pod shows "0/N nodes are available: node(s) had untolerated taint" in events

Cause: deploy_model does not support tolerations. GPU nodes in production clusters are almost always tainted.

Solution: Patch InferenceService with tolerations matching the GPU node taints, then delete the stuck pod. See common-issues.md for details.

Issue: NIM CUDA Driver Incompatibility

Error: NIM container crashes with error code 803 or CUDA-related errors

Cause: The latest NIM image tag may bundle a CUDA version incompatible with the GPU node's driver.

Solution: Pin NIM image to a specific tag compatible with the cluster's GPU driver version (e.g., 1.8.3 for T4 nodes with older drivers). Check the NVIDIA NIM release notes for driver compatibility.

Issue: Stale ReplicaSets After InferenceService Patch

Error: Multiple ReplicaSets exist after patching the InferenceService (e.g., adding tolerations), causing duplicate Pending pods

Cause: Each InferenceService spec change triggers a new ReplicaSet. Old ReplicaSets are not automatically cleaned up.

Solution: Scale down stale ReplicaSets to 0 replicas via resources_create_or_update (from openshift), or delete them. Identify the current ReplicaSet by checking which one has the latest creation timestamp.

Dependencies

MCP Tools

See Prerequisites for the complete list of required and optional MCP tools.

Related Skills

Reference Documentation

Critical: Human-in-the-Loop Requirements

See skill-conventions.md for general HITL and security conventions.

Skill-specific checkpoints:

Example Usage

See model-deploy examples for complete deployment walkthroughs (vLLM and NIM).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.