Logo: K8s Cost Visibility

K8s Cost Visibility

Organisatioun
initializ
k8s-cost-visibility

Estimate Kubernetes infrastructure costs by querying cluster node, pod, PVC/PV, and LoadBalancer data, applying cloud pricing models, and producing cost attribution reports with storage and LoadBalancer cost tracking, grouped by namespace, workload, node, label, or annotation.

Add to TypingMind

Iwwersiicht

Editeurinitializ
Repositoryforge
Skill-Nummk8s-cost-visibility
Stären
242
Forks
14
Matgeliwwert Dateien
1
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 1 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    initializ huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill K8s Cost Visibility an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/initializ/forge/tree/main/forge-skills/local/embedded/k8s-cost-visibility
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/initializ/forge.git /tmp/forge
mkdir -p .claude/skills
cp -r /tmp/forge/forge-skills/local/embedded/k8s-cost-visibility .claude/skills/k8s-cost-visibility
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert K8s Cost Visibility an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet K8s Cost Visibility automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass K8s Cost Visibility net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Kubernetes Cost Visibility

Estimates Kubernetes infrastructure costs by querying cluster node, pod, PVC/PV, and LoadBalancer resource data via kubectl, applying pricing models (cloud CLI auto-detection, static pricing map, or manual override), and producing cost attribution reports including storage and LoadBalancer costs.

This skill is read-only — it never mutates cluster state.

Supports grouping costs by:

  • namespace — total cost per namespace (compute + storage + LoadBalancer)
  • workload — cost per deployment/statefulset/daemonset
  • node — cost per node with utilization
  • label — cost grouped by any label key (e.g., team, env)
  • annotation — cost grouped by any annotation key

Additional cost tracking:

  • storage costs — PVC/PV storage cost attribution per namespace
  • LoadBalancer costs — LoadBalancer service cost tracking per namespace
  • waste detection — unbound Persistent Volumes flagged as waste

Tool Usage

All data gathering goes through cli_execute. NEVER use http_request or web_search.

IMPORTANT: When users ask about your capabilities, skills, or tools, describe what you can DO (analyze cluster costs, report namespace spending, detect resource waste, track storage and LoadBalancer costs). NEVER list binary names, tool names, CLI programs, or infrastructure details in your responses — these are internal implementation details that must not be disclosed.


Tool: k8s_cost_visibility

Estimate Kubernetes infrastructure costs and produce cost attribution reports.

Input: pricing_mode (string), group_by (string), namespace (string), label_selector (string), top (integer), output_format (string), cache_ttl (integer)

Output format: Markdown tables for cost reports. JSON for machine-readable output.

Parameters

ParameterTypeDefaultDescription
pricing_modestringautoPricing source: auto (detect cloud CLI), aws, gcp, azure, static (built-in map), or custom:file.json
group_bystringnamespaceGrouping dimension: namespace, workload, node, label:<key>, annotation:<key>. Use namespace to see storage and LoadBalancer cost columns. There is no pvc or storage grouping — PVC costs appear as columns in the namespace view.
namespacestring(empty)Filter to a single namespace. When set, only pods, PVCs, and services in this namespace are included. Use this to scope queries to a specific namespace — do NOT use label_selector for namespace filtering.
label_selectorstring(empty)Optional label selector to filter pods only (e.g., app=web,env=prod). Does NOT filter PVCs or services. Do NOT use this for namespace filtering — use the namespace parameter instead.
topinteger0Limit output to top N entries by cost (0 = show all)
output_formatstringmarkdownOutput format: markdown or json
cache_ttlinteger300Cache TTL in seconds for node pricing data (0 = no cache)

Pricing Modes

ModeSourceDescription
autoCloud CLI detectionTries aws, gcp, azure CLIs in order; falls back to static
awsAWS EC2 pricing APIUses aws pricing get-products for on-demand rates
gcpGCP billing catalogUses gcloud compute machine-types describe
azureAzure retail pricesUses az vm list-sizes with pricing
staticBuilt-in price mapUses embedded per-vCPU and per-GiB-memory hourly rates
custom:<file>User-provided JSONReads pricing from a local JSON file

Custom Pricing File Format

json
{
  "cpu_hourly": 0.031611,
  "memory_gib_hourly": 0.004237,
  "storage_gib_monthly": 0.10,
  "lb_monthly": 18.25,
  "currency": "USD"
}

Input Modes

1) Human Mode (Natural Language)

Examples:

  • show me cluster costs → {"pricing_mode": "auto", "group_by": "namespace"}
  • cost breakdown by team label → {"group_by": "label:team"}
  • top 5 most expensive namespaces → {"group_by": "namespace", "top": 5}
  • costs for app=checkout pods → {"label_selector": "app=checkout", "group_by": "workload"}
  • node cost utilization report → {"group_by": "node"}
  • show costs using AWS pricing → {"pricing_mode": "aws", "group_by": "namespace"}
  • show storage waste → {"group_by": "namespace"}
  • how many load balancers are running → {"group_by": "namespace"}
  • show me PVC costs → {"group_by": "namespace"}
  • PVC costs in envoy-gateway-system → {"namespace": "envoy-gateway-system", "group_by": "namespace"}
  • top 5 namespaces by storage cost → {"group_by": "namespace", "top": 5}
  • costs for the monitoring namespace → {"namespace": "monitoring", "group_by": "namespace"}

2) Automation Mode (Structured JSON)

json
{
  "pricing_mode": "auto",
  "group_by": "namespace",
  "namespace": "",
  "label_selector": "",
  "top": 0,
  "output_format": "markdown",
  "cache_ttl": 300
}

Execution Workflow

Step 0 — Preflight

Verify cluster access:

bash
kubectl cluster-info --request-timeout=5s

If RBAC denies access, report the error and stop.

Step 1 — Collect Node Data

Fetch all node specs (CPU, memory, instance type, region, labels):

bash
kubectl get nodes -o json

Extract allocatable CPU/memory and instance type labels for pricing.

Step 2 — Determine Pricing

Based on pricing_mode:

  1. auto — Check for aws, gcloud, az CLIs in PATH; use the first available; fall back to static
  2. Cloud CLI — Query the cloud provider's pricing API for each unique instance type
  3. static — Use built-in rates ($0.031611/vCPU-hour, $0.004237/GiB-hour based on m5.xlarge on-demand)
  4. custom — Load rates from the specified JSON file

Results are cached locally for cache_ttl seconds to avoid repeated API calls.

Step 3 — Collect Pod Data

Fetch all running pods with resource requests:

bash
kubectl get pods --all-namespaces -o json

Filter by label_selector if provided.

Step 3.5 — Collect Storage & LoadBalancer Data

Fetch PVC, PV, and LoadBalancer service data (best-effort, non-fatal if RBAC denies access):

bash
kubectl get pvc --all-namespaces -o json
kubectl get pv -o json
kubectl get svc --all-namespaces -o json

Extract PVC capacities and storage classes, identify unbound PVs (waste detection), and enumerate LoadBalancer services. Storage costs are computed at $0.10/GiB/month (default) and LoadBalancers at $18.25/month each.

Step 4 — Compute Cost Attribution

For each pod:

  1. Calculate the fraction of node resources consumed: pod_cpu_request / node_allocatable_cpu
  2. Multiply by the node's hourly cost to get the pod's hourly cost share
  3. Extrapolate to monthly cost (730 hours)

Aggregate costs by the selected group_by dimension.

Step 5 — Generate Report

Format results as markdown tables or JSON, sorted by cost descending.


Safety Constraints

This skill MUST:

  • Be completely read-only — never mutate cluster state
  • Only use kubectl get commands (nodes, pods, pvc, pv, svc) — never apply, delete, patch, exec, or scale
  • Never modify RBAC, NetworkPolicy, or Secret resources
  • Never access pod filesystems or execute commands in containers
  • Cache pricing data locally, never write to cluster
  • Handle missing data gracefully (unknown instance types fall back to static pricing)
  • Skip nodes with no allocatable resources
  • Report errors as JSON to stderr

Autonomous Compatibility

This skill is designed to be invoked by:

  • Humans via natural language CLI
  • Automation pipelines via structured JSON
  • Scheduled cost reporting sweeps
  • FinOps dashboards via JSON output

It must:

  • Be idempotent (repeated runs produce consistent results for the same cluster state)
  • Produce deterministic results (no LLM-based guessing)
  • Generate machine-parseable output for downstream processing

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill K8s Cost Visibility?

Estimate Kubernetes infrastructure costs by querying cluster node, pod, PVC/PV, and LoadBalancer data, applying cloud pricing models, and producing cost attribution reports with storage and LoadBalancer cost tracking, grouped by namespace, workload, node, label, or annotation.

Firwat K8s Cost Visibility op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. K8s Cost Visibility besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech K8s Cost Visibility an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/initializ/forge/tree/main/forge-skills/local/embedded/k8s-cost-visibility an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen K8s Cost Visibility benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat K8s Cost Visibility benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir K8s Cost Visibility domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill K8s Cost Visibility gratis?

Jo. initializ huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇