К основному содержанию
скилл Claude Code Gemini CLI CX Codex официальный · Google

gke-cost-optimization — скилл для Claude Code: что делает

Скилл помогает снижать расходы GKE: подбирает ресурсы, настраивает квоты и Spot VM. Нужен при разборе затрат кластера или workload.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add google/skills --skill gke-cost-optimization -a claude-code
Открыть на GitHub

Что делает gke-cost-optimization

Скилл разбирает способы снизить расходы Google Kubernetes Engine. Он помогает настроить resource quotas для tenant-ов, подобрать CPU и memory requests по фактической нагрузке, а также проверить варианты с VPA в режиме рекомендаций и MPA.

Для отказоустойчивых stateless и batch-workload он предлагает Spot VM через nodeSelector cloud.google.com/gke-spot: "true". Такие VM могут быть вытеснены с уведомлением за 30 секунд, поэтому нужны fault-tolerant workload и минимум 2 реплики. Stateful workload и критичные сервисы с одной репликой сюда не подходят.

Внутри есть YAML-шаблоны для квот, VPA и Deployment со Spot VM. Скилл также рассматривает machine families и CUDs. Ставьте его, если нужно работать именно с затратами GKE; для ComputeClass и GPU selection нужен gke-compute-classes.

Какие задачи решает

  • снизить расходы GKE-кластера
  • подобрать CPU и memory requests для pod-ов
  • настроить квоты ресурсов по namespace
  • перевести stateless workload на Spot VM
  • выбрать machine family или CUD

Примеры запросов агенту

  • Проверь расходы этого GKE-кластера и предложи, где уменьшить CPU и memory requests.
  • Настрой resource quota для namespace `payments` и подготовь YAML для `kubectl apply -f`.
  • Можно ли перевести этот batch Deployment на Spot VM? Проверь реплики и добавь нужный `nodeSelector`.

Как установить gke-cost-optimization

1Через Skills CLI (Vercel)

npx skills add google/skills --skill gke-cost-optimization -a claude-code

2Вручную: положить файлы

~/.claude/skills/gke-cost-optimization/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/gke-cost-optimization/

Из того же набора172

Весь набор →
bigquery-basics официальный google Управляет ресурсами BigQuery и запускает SQL-запросы. Подходит для создания датасетов, таблиц, представлений и базовой загрузки данных. Claude Code Gemini CLI CX Codex 17 678установок cloud-run-basics официальный google Скилл помогает управлять Cloud Run: разворачивать HTTP-сервисы, запускать задачи по событию или расписанию и вести фоновые worker pools. Claude Code Gemini CLI CX Codex 17 532установок gemini-api официальный google Подключает Gemini API из Agent Platform Google Cloud к агенту. Даёт доступ к моделям Gemini, мультимодальному вводу, вызову функций и кешированию контекста. Claude Code Gemini CLI CX Codex 17 116установок google-cloud-recipe-auth официальный Google LLC Скилл объясняет аутентификацию и права доступа в Google Cloud. Пригодится для настройки IAM, ADC и сервисных аккаунтов в разработке и продакшене. Claude Code Gemini CLI CX Codex 15 450установок google-cloud-recipe-onboarding официальный Google LLC Проводит разработчика через старт в Google Cloud: проверяет CLI, вход, проект и биллинг. Подходит для первого личного проекта. Claude Code Gemini CLI CX Codex 15 390установок cloud-sql-basics официальный google Скилл помогает создавать и объяснять Cloud SQL для MySQL, PostgreSQL и SQL Server. Пригодится при настройке базы в Google Cloud. Claude Code Gemini CLI CX Codex 14 679установок google-cloud-waf-security официальный google Скилл оценивает безопасность рабочих нагрузок в Google Cloud и предлагает меры для IAM, сетевой защиты, данных и операционной безопасности. Claude Code Gemini CLI CX Codex 14 620установок google-cloud-waf-cost-optimization официальный google Проверяет расходы Google Cloud по pillar Cost Optimization из Well-Architected Framework. Нужен для поиска простаивающих ресурсов, выбора скидок и правки размеров сервисов. Claude Code Gemini CLI CX Codex 14 266установок

Похожие

wizard Matt Pocock Скилл создаёт интерактивный bash-скрипт для ручных шагов: настройки сервисов, секретов CI и разовых миграций. Claude Code 553 369установок hyperframes-cli heygen-com Управляет проектами HyperFrames через терминал: собирает таймлайн, проверяет контраст кадров, запускает предпросмотр и рендерит видео локально или в облаке. Claude Code CX Codex Cursor +1 1 200 000установок setup-pre-commit Matt Pocock Скилл настраивает pre-commit для JavaScript-репозитория: Husky запускает форматирование, проверку типов и тесты перед коммитом. Claude Code 489 289установок using-git-worktrees Jesse Vincent Готовит изолированное рабочее дерево перед доработкой или выполнением плана. Проверяет текущий репозиторий, выбирает нативные средства платформы либо Git. Claude Code CX Codex 217 153установок finishing-a-development-branch Jesse Vincent Скилл проверяет тесты и помогает выбрать, как завершить работу в ветке: слить её, открыть Pull Request или оставить как есть. Claude Code CX Codex 214 439установок orca-cli stablyai Скилл даёт агенту доступ к worktree, терминалам, артефактам и встроенному браузеру Orca через CLI. Пригодится, когда работа идёт в окружении Orca. Claude Code CX Codex Cursor +1 353 000установок

Вопросы о gke-cost-optimization

Как установить gke-cost-optimization в Claude Code?

Выполните npx skills add google/skills --skill gke-cost-optimization -a claude-code. Файл скилла появится в ~/.claude/skills/gke-cost-optimization/SKILL.md.

Что делает gke-cost-optimization?

Скилл помогает оптимизировать стоимость GKE: rightsizing pod-ов, resource quotas, Spot VM, machine types, cost allocation и CUDs.

Какие workload подходят для Spot VM?

Подходят batch и data processing, dev/test, jobs с checkpointing и stateless web/API с минимум 2 репликами. Stateful workload и single-replica critical services не подходят из-за риска preemption.

Исходный текст

SKILL.md · Apache-2.0
---
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).
metadata:
  version: "1.0.1"
  category: CloudObservabilityAndMonitoring
---

# 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       |
| a4 / a4x      | Ultra-scale AI (Blackwell GPUs)                   | Highest       |

### 6. Committed Use Discounts (CUDs)

For steady-state workloads with predictable baseline usage, purchase 1-year or
3-year CUDs:

-   **Resource-based CUDs** (committed to a machine family/region): roughly
    high-30s% discount for 1-year, ~55% for 3-year (varies by machine family).
-   **Flexible CUDs** (spend-based, portable across families/regions): lower
    discounts (~28% 1-year, ~46% 3-year) in exchange for flexibility.
-   **Autopilot:** Autopilot-specific CUDs were retired in January 2026 — new
    commitments covering Autopilot usage are spend-based Compute Flexible CUDs
    (existing Autopilot CUD commitments run out their term).
-   Applied automatically to matching usage across the region.
-   Purchase via Google Cloud Console > Billing > Committed use discounts.

**Size the commitment to the steady-state baseline only.** A commitment bills for
the full term whether or not you use it, so over-committing to peak usage
converts a discount into waste. Measure the floor of actual usage over a
representative period, commit to that, and cover everything above it with the
elastic options already in this skill:

-   **Baseline** (always running) → resource-based CUDs.
-   **Variable / bursty** → autoscaling on on-demand capacity.
-   **Interruption-tolerant** (batch, CI, stateless workers) → Spot VMs, which
    stack with autoscaling and need no commitment.

When recommending CUDs, state the split explicitly rather than implying the whole
footprint should be committed.

### 7. Cluster Management & Multi-Tenancy

-   **Idle dev clusters**: GKE has no stop/start operation, and the cluster
    management fee accrues as long as the cluster exists. To cut idle costs,
    scale node pools to zero (`gcloud container clusters resize {cluster_name}
    --node-pool {pool_name} --num-nodes 0`) or delete and recreate the cluster
    via IaC (Terraform/Config Connector).
-   **Right-size node pools (Standard)**: Use Cluster Autoscaler with
    appropriate min/max limits.
-   **Cheap warm headroom instead of overprovisioned nodes**: Standby capacity
    buffers (Preview, GKE 1.36.0-gke.2253000+) keep pre-initialized nodes
    suspended — you pay only disk + IP instead of full node price, with ~30s
    resume. See the **`gke-cluster-autoscaler`** skill.
-   **Multi-tenant consolidation**: Share a single cluster across multiple
    engineering teams instead of maintaining per-team clusters, using Namespaces
    and ResourceQuotas to isolate workloads.

## Cost & Utilization Monitoring

To inspect live node/pod utilization (`kubectl top nodes/pods`), view cluster
cost budgets (`gcloud billing budgets list`), or query detailed billing reports
in BigQuery (`bq query`), refer to the **`gke-cost-analysis`** skill.

© google · Apache-2.0 · google/skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой