Generated banner for Gke Inference
Generated logo for Gke Inference

Gke Inference

GoogleOfficialPublished by Google

  • Skill
  • Workflow
  • Cloud and DevOps
  • Apache-2.0
  • No issues found

From the author

Deploys and optimizes AI/ML inference workloads on GKE, using GPUs, TPUs, and model servers. Use when deploying GKE inference servers, configuring GKE GPU resources for inference, or deploying LLMs on GKE. Don't use for migrating existing AI workloads to GKE (use google-cloud-solution-guided-gke-ai-migration), GKE RAG with Cloud SQL/AlloyDB (use google-cloud-solution-rag-enterprise-search-gke-sqldb), or batch/HPC (use gke-batch-hpc).
— the description by Google

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to deploying AI/ML inference workloads on GKE. It guides users through discovering compatible hardware and model server combinations, generating optimized Kubernetes manifests, and configuring infrastructure for efficient LLM serving. It includes best practices for GPU/TPU selection, autoscaling, and performance tuning to ensure reliable model inference.

What it does

  • Lists supported AI models and compatible hardware accelerators on GKE.
  • Generates optimized Kubernetes manifests for model deployment.
  • Provides guidance on selecting appropriate GPU or TPU accelerators for specific workloads.
  • Configures Horizontal Pod Autoscalers using GPU-specific metrics.
  • Offers troubleshooting steps for common inference issues like OOM errors or slow cold starts.
  • Defines ComputeClasses for targeting specific GPU nodes in Autopilot clusters.

When to use it

  • When you need to deploy an AI model like Llama, Gemma, or Mistral to a GKE cluster.
  • When you need to generate Kubernetes manifests tailored for AI inference.
  • When you are selecting hardware accelerators for model serving.
  • When you need to configure autoscaling for LLM inference workloads.

Advantages

  • Streamlines the selection of compatible hardware and model servers.
  • Provides standardized manifest generation for consistent deployments.
  • Includes performance optimization techniques like quantization and batching.
  • Enables effective resource management through GPU-based autoscaling.

Usage examples

“What hardware can I use to run the Gemma 2 9B model on GKE?”
The agent will list valid accelerator and model server combinations by querying the GKE AI profiles.
“Generate a deployment manifest for a vLLM server running Gemma 2 9B on an NVIDIA L4 GPU.”
The agent will output a Kubernetes manifest configured for the specified model, server, and accelerator.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/google/gke-inference/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip gke-inference.zip -d .agents/skills

Documentation by Google

GKE AI/ML Inference

Routing Note: For migrating existing AI workloads to GKE, open google-cloud-solution-guided-gke-ai-migration/SKILL.md. For GKE RAG with Cloud SQL or AlloyDB (pgvector), open google-cloud-solution-rag-enterprise-search-gke-sqldb/SKILL.md.

This reference covers deploying AI/ML inference workloads on GKE using Google's Inference Quickstart (GIQ) and best practices for LLM serving.

MCP Tools: apply_k8s_manifest, get_k8s_resource, get_k8s_logs, get_k8s_rollout_status, describe_k8s_resource, list_k8s_events. CLI-only: gcloud container ai profiles *

Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read Usage Attribution. For commands executed directly in the terminal (never in generated scripts, Terraform, or user code), prefix gcloud with CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-inference)" and append agent-skills/1.0 (skill:gke-inference) to User-Agent headers.

When to Use

  • Deploy an AI model (Llama, Gemma, Mistral, etc.) to GKE

  • Generate optimized Kubernetes manifests for inference

  • Select GPU/TPU accelerators for model serving

  • Configure autoscaling for LLM inference

Prerequisites

  • A golden path GKE Autopilot cluster (GPU workloads are supported via ComputeClasses and NAP)

  • gcloud CLI authenticated

  • Sufficient GPU/TPU quota in the target region

Workflow

1. Discovery: Find Models and Hardware
# List all supported models
gcloud container ai profiles models list --quiet

# Find valid accelerator/server combinations for a model
gcloud container ai profiles list --model=<MODEL_NAME> --quiet

# Example: what can run Gemma 2 9B?
gcloud container ai profiles list --model=gemma-2-9b-it --quiet
2. Generate Manifest
gcloud container ai profiles manifests create \
  --model=<MODEL_NAME> \
  --model-server=<SERVER> \
  --accelerator-type=<ACCELERATOR> \
  --target-ntpot-milliseconds=<NTPOT> --quiet > inference.yaml

Parameters:

  • --model: Model ID (e.g., gemma-2-9b-it, llama-3-8b)

  • --model-server: Inference server (vllm, tgi, triton, tensorrt-llm)

  • --accelerator-type: GPU/TPU type (nvidia-l4, nvidia-tesla-a100, nvidia-h100-80gb)

  • --target-ntpot-milliseconds: Target Normalized Time Per Output Token (optional, for latency optimization)

Example:

gcloud container ai profiles manifests create \
  --model=gemma-2-9b-it \
  --model-server=vllm \
  --accelerator-type=nvidia-l4 \
  --target-ntpot-milliseconds=50 --quiet > inference.yaml
3. Review and Deploy
# Review for placeholders (HF tokens, PVCs)
cat inference.yaml

# Deploy
kubectl apply -f inference.yaml

# Monitor
kubectl get pods -w
kubectl logs -f <POD_NAME>

Some models require Hugging Face tokens. Create a Kubernetes Secret and reference it in the manifest.

GPU ComputeClass for Inference

For Autopilot clusters, create a ComputeClass to target GPU nodes:

apiVersion: cloud.google.com/v1
kind: ComputeClass
metadata:
  name: l4-inference
spec:
  priorities:
  - machineFamily: g2
    gpu:
      type: nvidia-l4
      count: 1
    minCores: 4
    minMemoryGb: 16

Accelerator Selection Guide

AcceleratorBest ForMemoryRelative Cost
NVIDIA T4Budget inference,16 GBLowest
: : lightweight legacy : : :
: : models : : :
NVIDIA L4 (G2)Small-medium model24 GBLow
: : inference, video, : : :
: : graphics : : :
NVIDIA RTX PRO 6000Multimodal AI,96 GBMedium
: (G4) : high-fidelity 3D, : : :
: : fine-tuning : : :
Cloud TPU v5eCost-effectiveVariesMedium
: : transformer inference : : :
Cloud TPU v5pHigh-performanceVariesHigh
: : training : : :
Cloud TPU v6eHigh-efficiency next-gen32 GB/chipMedium-High
: (Trillium) : training & serving : : :
Cloud TPU v7xUltra-scale inference &192 GB/chipHigh
: (Ironwood) : agentic workflows : : :
NVIDIA A100Large model inference,40/80 GBHigh
: : enterprise ML : : :
NVIDIA H100 / H200Frontier model training,80/141 GBHighest
: : high throughput : : :
NVIDIA B200 (A4)Blackwell-scale192 GBHighest
: : training, FP4 precision : : :
NVIDIA GB200 (A4X)Rack-scale AI (GraceMassiveHighest
: : Blackwell Superchip) : : :

Autoscaling LLM Inference

GPU-based autoscaling

Use custom metrics for GPU utilization:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: llm-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: llm-server
  minReplicas: 1
  maxReplicas: 10
  metrics:
  - type: Pods
    pods:
      metric:
        name: gpu_duty_cycle
      target:
        type: AverageValue
        averageValue: "80"
Best practices for inference autoscaling
  1. Use DCGM metrics: Golden path enables DCGM monitoring for GPU utilization metrics

  2. Set appropriate minReplicas: At least 1 for always-on serving; 0 for batch/on-demand

  3. Tune scale-down delay: LLM model loading is slow; use longer stabilization windows

  4. Consider queue depth: Scale on pending requests rather than pure GPU utilization for latency-sensitive workloads

Optimization Tips

  • Quantization: Use quantized models (GPTQ, AWQ) to reduce GPU memory and increase throughput

  • Batching: Configure model server batch size for throughput vs latency trade-off

  • Tensor parallelism: Split large models across multiple GPUs within a node

  • KV cache optimization: Tune --gpu-memory-utilization in vLLM for KV cache allocation

Troubleshooting

IssueCauseFix
InvalidUnsupported tupleRe-run `gcloud container ai
: model/accelerator : : profiles list :
: combination : : --model=<MODEL>` :
GPU quota exceededRegional quota limitRequest quota increase or
: : : try a different region :
OOM on GPUModel too large forUse larger GPU, enable
: : accelerator : quantization, or use tensor :
: : : parallelism :
Slow cold startLarge model loading fromUse local SSD for model
: : registry : caching; pre-pull images :

Files

references/attribution.md

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command with this skill, follow these usage attribution instructions. Tag every command you execute directly in the terminal so usage can be attributed. The tag identifies only the skill and its version; it carries no user data.

  • gcloud CLI Commands: Prefix every gcloud invocation, whatever the subcommand, with the metrics environment variable. Set it inline on each command because shell state may not persist between commands:

    CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-inference)" \
    gcloud <command> [flags]

    Do not use gcloud config set for this: it would persist beyond the current task and mislabel unrelated usage.

  • Direct HTTP, REST, and MCP Requests: On direct HTTP calls to Google Cloud APIs (for example with curl) or HTTP requests to a remote MCP server, include agent-skills/1.0 (skill:gke-inference) in the User-Agent header. If a User-Agent header is already specified, append this string to the end of it rather than overwriting existing User-Agent data — the collection pipeline parses the agent-skills/<version> and skill:<name> tokens, so any rewording breaks attribution:

    User-Agent: <existing_user_agent> agent-skills/1.0 (skill:gke-inference)
  • Constraint for Generated Code: The tracking prefix is strictly for commands you execute directly in the terminal. Do NOT include this tracking prefix in generated scripts, Terraform templates, or code provided to the user for their own repositories.

  • User Opt-Out: If the user asks to disable or remove tracking or attribution tags, omit the CLOUDSDK_METRICS_REQUEST_ATTRIBUTION variable and custom User-Agent suffix from all commands.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs a command-line tool, Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Google
Publisher
Google (Official)
Source
google/skills · skills/cloud/gke-inference · commit 2194d3b
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google or Google.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download gke-inference.zip