gke-cost-optimization
Optimizes GKE costs, rightsizes workloads, and configures Spot VMs, CUDs, cost allocation, and resource quotas.
Skill by googleOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/google-gke-cost-optimization
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/gke-cost-optimization
What's inside
- Skill name
gke-cost-optimization- Description
- Optimizes GKE costs, rightsizes workloads, and configures Spot VMs, CUDs, cost allocation, and resource quotas. Use when optimizing GKE cluster or workload costs, configuring GKE cost allocation or quotas, rightsizing CPU/memory requests, or selecting Spot VMs and machine types. Don't use for general compute class provisioning or GPU Selection (use gke-compute-classes instead).
- License
- Apache-2.0
- Metadata
- version: 1.0.1 · category: CloudObservabilityAndMonitoring
- Instructions
- 174 lines in SKILL.md · view on GitHub
Files (5)
- SKILL.md
- resource-quota-example.yaml · assets/
- spot-deployment-example.yaml · assets/
- vpa-recommendation-mode.yaml · assets/
- attribution.md · references/
SKILL.md (first lines)
# GKE Cost Optimization
This reference covers strategies and workflows for reducing Google Kubernetes
Engine (GKE) costs while maintaining a secure and reliable posture.
## Attribution
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
MUST read [Usage Attribution](references/attribution.md). 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-cost-optimization)"`
and append `agent-skills/1.0 (skill:gke-cost-optimization)` to `User-Agent` headers.
## Workflows & Optimization Strategies
### 1. Prerequisite: Cost Allocation & Monitoring
To enable GKE cost allocation (`--enable-cost-allocation`) for billing tracking
across namespaces and labels, inspect live cluster utilization (`kubectl top`),
or run historical cost breakdown queries in BigQuery (`bq`), use the
**`gke-cost-analysis`** skill. Once tracking is active and waste is diagnosed,
apply the optimization workflows below.
### 2. Configure Resource Quotas
Resource quotas restrict total resource consumption across tenants in
multi-tenant clusters, preventing runaway costs. Template:
[assets/resource-quota-example.yaml](assets/resource-quota-example.yaml)
(set namespace + `hard` limits, then `kubectl apply -f`).
### 3. Pod Rightsizing (VPA & MPA)
Adjust pod resource requests to match actual utilization. Over-provisioned
requests are one of the largest sources of waste.
- **Use VPA in Recommendation Mode** (`updateMode: "Off"` — recommends
without evicting):
```bash
# 1. Deploy VPA in recommendation mode (template: assets/vpa-recommendation-mode.yaml)
kubectl apply -f assets/vpa-recommendation-mode.yaml
# 2. Wait 24+ hours for data collection, then read recommendations
kubectl get vpa {deployment_name}-vpa -o jsonpath='{.status.recommendation}'
```
- **Optimization Rules:**
Condition | Action | Savings
----------------------------- | ---------------------------------- | -------
CPU request >5x P95 actual | Reduce to `P95 * 1.2` | High
Memory request >3x P95 actual | Reduce to `P95 * 1.2` | High
CPU request >2x P95 actual | Reduce to `P95 * 1.2` | Medium
No resource requests set | Add requests (enables bin-packing) | Medium
- **Use MPA**: Reconcile HPA and VPA recommendations when scaling both
horizontally and vertically to avoid conflicting scale events.
- **Review Cost Recommendations**: Check Google Cloud Console (`Cost
Management` > `GKE Cost Optimization`) for built-in rightsizing suggestions.
### 4. Spot VMs via ComputeClasses & NodeSelector
Use Spot VMs for fault-tolerant workloads to achieve 60-90% cost reduction.
#### 4.1 ComputeClass Configuration
For a Spot-first ComputeClass with On-Demand fallback (priority ordering,
`activeMigration`, machine family selection), use the **`gke-compute-classes`**
skill — ComputeClass YAML generation and priority configuration are its domain,
not this skill's.
#### 4.2 Direct Workload Spot Selection (`nodeSelector`)
For stateless or batch workloads in GKE Autopilot, target Spot capacity directly
using `nodeSelector`:
> [!WARNING] **Preemption Warning**: Spot VMs are interruptible and can be
> preempted at any time with a 30-second notice. Workloads must be
> fault-tolerant and run with at least 2 replicas for high availability. Always
> explicitly warn users about this preemption risk when recommending Spot VMs.
The exact Pod-level selector is:
```yaml
nodeSelector:
cloud.google.com/gke-spot: "true"
```
Full worked Deployment (replicas >= 2, `terminationGracePeriodSeconds: 25`,
`preStop` hook): [assets/spot-deployment-example.yaml](assets/spot-deployment-example.yaml).
**Spot-Suitable Workloads:**
Workload | Spot-Suitable?
--------------------------------- | ---------------
Batch / data processing | Yes
Dev / test environments | Yes
Stateless web/API (replicas >= 2) | Yes (with PDBs)
Jobs with checkpointing | Yes
Stateful workloads (databases) | No
Single-replica critical services | No
### 5. Machine Type Selection
When choosing node shapes or configuring ComputeClasses:
| Family | Use Case | Relative Cost |
| ------------- | ------------------------------------------------- | ------------- |
| e2 | General purpose, burstable | Lowest |
| t2a / t2d | Scale-out (Arm/AMD), price-performance optimized | Low |
| n4a | Axion Arm-based, general-purpose price-performance | Low |
| n4 / n4d | General purpose (Intel/AMD), flexible shapes | Low-Medium |
| c4a | Axion Arm-based, general-purpose, high efficiency | Medium |
| c3 / c4 | Compute-optimized (Intel) | Medium-High |
| c3d / c4d | Compute-optimized (AMD), high throughput | Medium-High |
| ek-standard | Autopilot enhanced | Medium |
| m3 / x4 | Memory-optimized, SAP HANA, large databases | High |
| g2 (L4 GPU) | AI inference | High |
| a3 (H100 GPU) | AI training | Highest |From google/skills, Apache-2.0.
More from google/skills
- 0.865score
google-ads-api-account-diagnostics
google-ads-api-teamOfficial
Diagnoses Google Ads account performance issues such as conversion loss (value or volume), low lead flow/volume, and lost impression share (opportunities) due…
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.861score
secops-triage
Google LLCOfficial
Expert guidance for security alert triage in Google SecOps.
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.861score
secops-detection-engineering
Google LLCOfficial
Author, validate, test, and deploy YARA-L 2.0 detection rules and evaluate end-to-end detection coverage gaps in Google SecOps.
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.861score
secops-hunt
Google LLCOfficial
Expert guidance for proactive threat hunting in Google SecOps.
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.861score
secops-cases
Google LLCOfficial
Manage Google Security Operations (SecOps) SOAR cases throughout their lifecycle.
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.861score
secops-investigate
Google LLCOfficial
Expert guidance for deep security incident and entity investigations in Google SecOps.
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.824score
google-ads-api-quickstart
google-ads-api-teamOfficial
Guides developers through Google Ads API quickstart: credential setup, choosing from 6 client libraries/REST, configuring environments, and running a…
SkillBFreshness: B★ 21.5KClaude Code +9 - 0.819score
google-ads-api-mcp-setup
google-ads-api-teamOfficial
Guides developers through downloading, configuring, and installing the official open-source Google Ads MCP Server.
SkillBFreshness: B★ 21.5KClaude Code +9 - 0.815score
ima-dai-sdk
Google LLCOfficial
Integrates the Google Interactive Media Ads (IMA) Dynamic Ad Insertion (DAI) SDK into websites, web apps, mobile apps, or TV apps.
SkillBFreshness: B★ 21.5KClaude Code +9 - 0.815score
ima-sdk-client-side
Google LLCOfficial
Supports Interactive Media Ads (IMA) SDK.
SkillBFreshness: B★ 21.5KClaude Code +9 - 0.699score
gcloud
googleOfficial
Provides safety-critical validation, guardrails, and data reduction for gcloud CLI operations across Google Cloud Platform (GCP) services and infrastructure.
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.699score
agent-platform-deploy
googleOfficial
Deploy open models or custom weights from Model Garden to Agent Platform endpoints, check the status of an in-progress deployment operation, or clean up…
SkillAFreshness: A★ 21.5KClaude Code +9
Signals
- Stars
- 21,542
- Forks
- 1,821
- Open issues
- 21
- Last commit (this folder)
- Oct 19, 2026 (9 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.1
- License
- Apache-2.0
- Repository
- github.com/google/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from google
- 0.699score
retrieving-developer-knowledge
googleOfficial
Searches, retrieves, and synthesizes official Google developer documentation across Google Cloud, AI/Gemini, Android, Chrome, Web, Flutter, Go, Firebase, and…
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.699score
data-manager-api-setup
googleOfficial
Guides developers through client library installation and authentication setup steps for the Data Manager API.
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.699score
agent-platform-migrate-from-ai-studio
googleOfficial
Guides agents and users through migrating from Gemini API in Google AI Studio to Gemini Enterprise Agent Platform (formerly Vertex AI).
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.699score
gcloud
googleOfficial
Provides safety-critical validation, guardrails, and data reduction for gcloud CLI operations across Google Cloud Platform (GCP) services and infrastructure.
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.699score
google-cloud-recipe-onboarding
googleOfficial
Guides a developer's first steps on Google Cloud, covering account creation, billing setup, project management, and deploying a first resource.
SkillAFreshness: A★ 21.5KClaude Code +9 - 0.699score
agent-platform-deploy
googleOfficial
Deploy open models or custom weights from Model Garden to Agent Platform endpoints, check the status of an in-progress deployment operation, or clean up…
SkillAFreshness: A★ 21.5KClaude Code +9
Cite this page
gke-cost-optimization skill. Agent Mart. https://agentmart.dev/skills/google-gke-cost-optimization (last updated 2026-10-24)