PluginBench
Skill
Pass
Audit score 90

gke-inference

google/skills

Deploy and optimize AI/ML inference workloads on GKE with GPUs, TPUs, and model servers.

What is gke-inference?

Deploys AI/ML inference workloads on GKE using Google's Inference Quickstart and best practices for LLM serving. Use this when deploying inference servers, configuring GPU/TPU resources, or serving LLMs on GKE. Not for migrating existing workloads, RAG pipelines, or batch/HPC jobs.

  • Generate optimized Kubernetes manifests for model inference servers (vLLM, TGI, Triton, TensorRT-LLM)
  • Select and configure GPU/TPU accelerators (L4, A100, H100, Cloud TPU v5e/v5p/v6e/v7x) for model serving
  • Deploy supported models (Llama, Gemma, Mistral, etc.) to GKE Autopilot clusters
  • Configure horizontal pod autoscaling for LLM inference with GPU utilization metrics
  • Optimize inference performance through quantization, batching, tensor parallelism, and KV cache tuning

How to install gke-inference

npx skills add https://github.com/google/skills --skill gke-inference
Prerequisites
  • A golden path GKE Autopilot cluster with GPU workload support via ComputeClasses
  • gcloud CLI authenticated and configured
  • Sufficient GPU/TPU quota in the target region
  • Hugging Face tokens for gated models (stored as Kubernetes Secrets)
Claude Code
Cursor
Windsurf
Cline

How to use gke-inference

  1. 1.Run `gcloud container ai profiles models list` to discover supported models and accelerators
  2. 2.Use `gcloud container ai profiles list --model=<MODEL_NAME>` to find valid hardware/server combinations
  3. 3.Generate a manifest with `gcloud container ai profiles manifests create` specifying model, server, and accelerator type
  4. 4.Review the generated YAML for placeholders (HF tokens, PVCs) and customize as needed
  5. 5.Deploy with `kubectl apply -f inference.yaml` and monitor with `kubectl get pods -w` and `kubectl logs`
  6. 6.Configure HorizontalPodAutoscaler with GPU metrics (gpu_duty_cycle) for autoscaling inference replicas

Use cases

Good for
  • Deploy a Gemma 2 9B model on L4 GPUs with vLLM for real-time inference
  • Scale LLM inference endpoints based on GPU duty cycle and request queue depth
  • Serve multiple models on different accelerator types within a single GKE cluster
  • Optimize large model inference across multiple GPUs using tensor parallelism
  • Configure cost-effective inference using quantized models and appropriate hardware selection
Who it's for
  • ML engineers deploying inference services on GKE
  • Platform engineers configuring GPU/TPU infrastructure for model serving
  • DevOps teams managing LLM endpoints at scale
  • Data scientists optimizing model serving performance and cost

gke-inference FAQ

What models and accelerators are supported?

Run `gcloud container ai profiles models list` and `gcloud container ai profiles list --model=<MODEL_NAME>` to see all supported combinations. Common models include Llama, Gemma, Mistral; common accelerators include NVIDIA L4, A100, H100, and Cloud TPU variants.

How do I handle Hugging Face token requirements?

Create a Kubernetes Secret with your HF token and reference it in the generated manifest. Some gated models require authentication to download.

What's the difference between GPU and TPU for inference?

GPUs (L4, A100, H100) are flexible for various model types and batch sizes; Cloud TPUs (v5e, v5p, v6e, v7x) are cost-effective for transformer inference but have specific model requirements. Choose based on model type, latency requirements, and cost.

How do I scale inference workloads?

Use HorizontalPodAutoscaler with GPU metrics like gpu_duty_cycle. Set appropriate minReplicas (1 for always-on, 0 for on-demand) and longer scale-down delays since model loading is slow.

What optimization techniques reduce GPU memory and latency?

Use quantized models (GPTQ, AWQ), configure model server batching, enable tensor parallelism across GPUs, and tune KV cache allocation with `--gpu-memory-utilization` in vLLM.

Full instructions (SKILL.md)

Source of truth, from google/skills.


name: gke-inference description: >- 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). metadata: version: "1.0.1" category: Containers

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 *

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 :