Zum Inhalt springen
Skillpedia
Deployment & Cloud (DevOps)22k · #10285

gke-cost-optimization

Was er macht

Dieser Skill führt einen KI-Agenten durch die Senkung der Ausgaben für Google Kubernetes Engine, ohne den Cluster unzuverlässig oder unsicher zu machen. Er ist für Teams, die ihre Clusterkosten senken wollen.

Wann du ihn nutzt

  • ✓Wenn du GKE-Kosten senken willst, ohne den Cluster weniger zuverlässig zu machen.
  • ✓Wenn deine Pods weit mehr CPU oder Speicher anfordern, als sie nutzen.
  • ✓Wenn du Ressourcenkontingente willst, damit ein Team in einem gemeinsamen Cluster nicht zu viel verbraucht.

Link zum Skill

https://github.com/google/skills/blob/main/skills/cloud/gke-cost-optimization/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/google/skills/blob/main/skills/cloud/gke-cost-optimization/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Meine GKE-Pods fordern deutlich mehr Speicher an, als sie nutzen. Wie senke ich meine Clusterrechnung?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent schlägt Ressourcenkontingente vor, passt die Ressourcenanforderungen der Pods mit Autoskalierungs-Werkzeugen an und verweist auf Spot-VMs oder günstigere Maschinentypen.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

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. 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 (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):
# 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:

nodeSelector:
  cloud.google.com/gke-spot: "true"

Full worked Deployment (replicas >= 2, terminationGracePeriodSeconds: 25, preStop hook): 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 G
Häufige Fragen

Richtet er die Kostenverfolgung ein?

Für Verfolgung und das Finden von Verschwendung nutzt er den Skill zur GKE-Kostenanalyse und wendet dann die Sparschritte an.

Was ist ein Ressourcenkontingent?

Ein Ressourcenkontingent begrenzt die gesamte CPU und den gesamten Speicher, die ein Team oder ein Namespace nutzen kann.

Deckt er die GPU-Auswahl ab?

Nein. Die GPU-Auswahl übernimmt der Skill für Compute Classes.

Details

Originalbeschreibung des Autors

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).

repo: google/skills

Beliebtheit

GitHub-Sterne
22k
Platz im Ranking
#10285
Lizenz
Apache-2.0
Aktualisiert
2.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills