New to Claude Skills? Learn how to install them →

google on GitHub

GKE AI/ML Inference

Free

Optimize AI/ML inference workloads on GKE with ease.

by google17.6k stars on google/skills
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What GKE AI/ML Inference does

GKE AI/ML Inference is a specialized skill designed for deploying and optimizing AI and machine learning inference workloads on Google Kubernetes Engine (GKE). This skill leverages Google's Inference Quickstart (GIQ) and provides best practices for serving large language models (LLMs) effectively. It is particularly useful for developers and data scientists looking to streamline the deployment of AI models such as Llama, Gemma, and Mistral, ensuring they can utilize the appropriate hardware resources efficiently.

The skill enables users to generate optimized Kubernetes manifests for inference, select suitable GPU or TPU accelerators, and configure autoscaling for LLM inference. Users can easily discover supported models and hardware combinations using the provided command-line tools, which simplifies the process of setting up an inference server. The ability to create a manifest file tailored to specific model requirements and hardware capabilities makes this skill a valuable asset for anyone working with AI deployments on GKE.

To get started, users must have a GKE Autopilot cluster configured to support GPU workloads, along with the necessary permissions and quotas for GPU or TPU resources. The workflow includes discovering models, generating manifests, and deploying them using standard Kubernetes commands. Additionally, the skill provides guidance on best practices for autoscaling and optimization, ensuring that users can maintain efficient and responsive AI inference services.

Overall, GKE AI/ML Inference is an essential skill for developers and data scientists who need to deploy AI models on GKE while optimizing for performance and resource utilization. It streamlines the deployment process and provides the necessary tools to manage inference workloads effectively.

When to use it

Use this skill when you need to deploy AI models on GKE and require optimized configurations for GPU or TPU resources.

When not to use it

Avoid this skill for generic batch jobs or high-performance computing tasks, as it is specifically tailored for inference workloads.

What you can build with it

Deploying a New AI Model

Quickly deploy a new AI model like Llama to GKE by generating the appropriate Kubernetes manifest and configuring the necessary resources.

Optimizing Resource Utilization

Select the best GPU or TPU accelerators for your model to ensure optimal performance and cost efficiency during inference.

Setting Up Autoscaling for Inference

Configure autoscaling for your LLM inference server to handle varying loads while maintaining performance and minimizing costs.

How to install GKE AI/ML Inference

View source

1. Install with the skills CLI

npx skills add google/skills/gke-inference --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by google

GKE AI/ML Inference

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 :

Frequently asked questions about GKE AI/ML Inference

Similar skills