mcpField
K
kubesense-infra

kubesense-infra

github.com/kubesense-aiCloud & DevOps396 installsUpdated 3d ago
Repository

About kubesense-infra

kubesense-infra is a Kubernetes infrastructure and inventory skill for KubeSense users investigating clusters, nodes, pods, and workloads. It covers platform-detected issues, infrastructure failures, and recent changes, with an investigation flow that starts from lower-cost signals.

Key features

  1. 01Discover clusters, nodes, pods, and workloads
  2. 02Inspect pod container states and restart reasons
  3. 03Query Kubernetes-layer failures and detected issues
  4. 04Check image updates and replica scaling changes
  5. 05Follow a signal-by-signal investigation flow

Use cases

  1. 01Inventory pods and workloads across clusters
  2. 02Investigate pod restarts or OOMKilled events
  3. 03Check deployments or scaling before an incident
  4. 04Review node pressure and scheduling failures

MCP support

This skill requires a connection to the KubeSense MCP server and uses its infrastructure and inventory tools. It guides MCP clients in discovering cluster objects, querying failures, and checking recent changes.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/kubesense-ai/kubesense-mcp-skills --skill kubesense-infra

After installing, type/kubesense-infrain Claude Code to confirm it loaded.

Details

From the project README

KubeSense Infrastructure & Inventory

Telemetry tells you a service is unhealthy. These tools tell you what exists, what is failing at the Kubernetes layer, and what changed — the context that turns a symptom into a cause.

Requires the KubeSense MCP server. See kubesense-mcp for connection and auth.

Routing — Read This First

The user is asking…CallNot
"which clusters / what cluster names can I use?"list-clustersguessing a cluster name — every other tool's clusters filter is free-text with no validation, so a typo silently returns nothing
"what's running / how many pods / pod inventory"list-podssearch-logs — logs only show pods that logged
"why is this pod restarting / crashlooping / OOMKilled"get-infra-issueslist-pods (gives the restart count, not the reason)
"what changed / did someone deploy / why did it break at 14:00"get-recent-changesanything else — check this first, it is the cheapest root cause
"what's broken across the estate"list-issues (platform's own detection)re-deriving issues from raw traces
"node pressure / eviction / scheduling failures"list-nodes, then get-node-detailanalyze-metrics (use it to confirm, not to discover)
"service health: RPS, p95, error rate per app"list-workloadsanalyze-traces (right answer for arbitrary slicing, overkill for a health sweep)
"container exit code / last state / restart reason"get-pod-detaillist-pods

Discovery order. list-clusters → list-workloads / list-pods → get-*-detail. Names flow forward: never type a cluster, namespace, workload, or pod name you have not read out of a previous call.

Tools

ToolPurposeRequired args
list-clustersClusters this deployment monitors—
list-nodesNodes with CPU/mem/disk pressure and readiness—
get-node-detailOne node: conditions, taints, addresses, capacityname
list-podsPods with phase, restarts, usage—
get-pod-detailOne pod: container statuses, exit codes, last state, QoSname, namespace, cluster
list-workloadsWorkloads with golden signals (RPS, p95, error rate)—
get-workload-detailOne workload: replicas, 4xx/5xx counts, RPSworkload, namespace
list-issuesProblems KubeSense already detected—
get-infra-issuesK8s-layer failures: OOM, crashes, probes, scheduling, image pull—
get-recent-changesImage updates (deploys) and replica scaling—

Every tool defaults to the last 1 hour and all accessible clusters. Pass from_time/to_time (RFC3339) to widen; pass clusters to narrow.

list-clusters

Call this first when you need a cluster name. It is the only discovery for the clusters filter that every other tool accepts.

{ "search": "prod" }

Returns TSV: name, source, env_type, updated_at.

Nodes

{ "clusters": ["prod-us"], "sort_by": "memory_usage_precent", "sort_direction": "DESC" }

Warning

sort_by for nodes is spelled _precent, not _percent — the accepted values are memory_usage_precent, disk_usage_precent, cpu_usage_precent. The output columns use the correct spelling (memory_usage_percent). Passing _percent to sort_by does not sort.

Output: name, cluster, ready, running_pods, cpu_usage_percent, memory_usage_percent, disk_usage_percent, kubelet_version, instance_type, uid, creation_timestamp.

get-node-detail takes name (required) and optional clusters to disambiguate a name present in several clusters. It returns conditions, addresses, labels, taints, and capacity/usage as a record with ## conditions / ## addresses sub-tables.

Pods

{ "namespace": "production", "status": "Pending", "sort_by": "memory_usage", "sort_direction": "DESC" }
  • status filters on pod phase: Running, Pending, Failed, Succeeded, Unknown.
  • sort_by accepts memory_usage or cpu_usage only.

Output: name, namespace, cluster, status, owner_kind, owner, node, restarts, cpu_usage, memory_usage, creation_time.

get-pod-detail needs all three of name, namespace, cluster. It is the tool that answers why a pod restarted — container statuses carry the restart reason, exit code, and last terminated state, which list-pods does not.

Workloads

The application-level view — one row per Deployment/StatefulSet/DaemonSet with its golden signals already joined from traces.

{ "namespace": "production", "kind": "Deployment", "sort_by": "error_rate", "sort_direction": "DESC" }

sort_by accepts rps, p95, errors, error_rate, restarts.

Output: name, namespace, cluster, kind, ready, desired, restarts, rps, p95, error_rate, issue_count, service_protocols.

Use this for a health sweep — it is one call for what would otherwise be an analyze-traces per workload. Drop to analyze-traces when you need a slice the summary doesn't have (by endpoint, by status code, by attribute).

list-issues

KubeSense's own issue detection — errors, latency, and connectivity problems between workloads. Prefer it over re-deriving problems from raw telemetry.

Output: issue_id, kind, cluster, primary_workload, primary_namespace, associate_workload, issue_reason, return_code, subtype, sum_issue_count, max_last_seen.

associate_workload is the other side of a connectivity issue — the dependency that primary_workload failed to reach.

get-infra-issues

Kubernetes-layer failures, from cluster events. This is the OOM / CrashLoop / probe-failure tool.

{ "namespace": "production", "workload": "checkout", "reason": "OOMKilling" }

Known reason values: OOMKilling, BackOff, Unhealthy, FailedScheduling, FailedMount, ImagePullBackOff, NodeNotReady. Omit reason to see all failure modes — narrow only once you know which one you're chasing.

Output: reason, type, workload, object, namespace, exit_code (crashes only), message, count, last_seen. Defaults to limit 50, max 200.

Layer routing: infra failures → this tool. Application errors and latency → analyze-traces / search-traces. What changed → get-recent-changes.

get-recent-changes

Image updates (deploys) and replica scaling, from cluster events. Usually the first thing to check in any investigation — "what changed right before it broke" is the cheapest hypothesis you will test.

{ "namespace": "production", "workload": "checkout", "kind": "image_update" }

kind is image_update or scaling; omit for both. Output: kind, workload, namespace, object, detail, when — where detail reads like kubesense: dev-v1.2.1279 -> dev-v1.2.1280 or replicas 1 -> 0. Defaults to limit 50, max 200.

Scope with namespace + workload. Both are optional but strongly recommended — an unscoped call across a busy cluster returns mostly noise.

Investigation Pattern

Symptom → context → cause, cheapest signal first:

1. get-recent-changes    namespace+workload → did we just deploy or scale?
2. get-infra-issues      same scope        → is the platform killing it (OOM, probes, sched)?
3. list-pods / get-pod-detail               → restart counts, exit codes, last state
4. analyze-traces / search-logs              → application-level errors and latency
5. analyze-metrics                           → confirm resource pressure quantitatively

Steps 1–2 are two cheap calls that resolve a large share of incidents outright. Reach for telemetry once they come back clean.

Rules

  1. list-clusters before any clusters filter. The filter is unvalidated free text — a wrong name returns an empty result that looks exactly like "no data".
  2. Names flow forward from list → detail calls. Never invent a pod, node, workload, or namespace name.
  3. get-pod-detail requires name + namespace + cluster; get-workload-detail requires workload + namespace. Discover them with the matching list-* call.
  4. Node sort_by uses the misspelling _precent; output columns use _percent.
  5. Prefer list-issues / get-infra-issues over re-deriving problems from raw telemetry — the platform already did the detection.
  6. Scope get-recent-changes and get-infra-issues with namespace + workload; unscoped calls are noisy.
  7. Default window is 1 hour. If a result set looks empty, widen the window before concluding nothing happened.

Comments

Markdown supported