본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)22k · #10285

gke-cost-optimization

하는 일

AI 에이전트가 클러스터를 안정적이고 안전하게 유지하면서 Google Kubernetes Engine 지출을 줄이도록 안내합니다. 클러스터 비용을 줄이려는 팀을 위한 스킬입니다.

사용하는 경우

  • ✓클러스터를 덜 안정적으로 만들지 않으면서 GKE 비용을 줄이고 싶을 때.
  • ✓파드가 실제 사용량보다 훨씬 많은 CPU나 메모리를 요청할 때.
  • ✓공유 클러스터에서 한 팀이 너무 많이 쓰지 못하도록 리소스 쿼터를 두고 싶을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/google/skills/blob/main/skills/cloud/gke-cost-optimization/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 GKE 파드가 실제로 쓰는 것보다 메모리를 훨씬 많이 요청해요. 클러스터 비용을 어떻게 낮출 수 있을까요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 리소스 쿼터를 제안하고, 오토스케일링 도구로 파드의 리소스 요청을 조정하며, 비용이 적게 드는 Spot VM이나 머신 유형을 안내합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

비용 추적도 설정하나요?

추적과 낭비 찾기는 GKE 비용 분석 스킬을 쓰고, 그다음 절감 단계를 적용합니다.

리소스 쿼터란 무엇인가요?

팀이나 네임스페이스가 쓸 수 있는 CPU와 메모리 총량을 제한하는 설정입니다.

GPU 선택도 다루나요?

아니요. GPU 선택은 compute classes 스킬이 맡습니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
22k
순위
#10285
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬