{"id":47249813,"url":"https://github.com/yaacov/kubectl-metrics","last_synced_at":"2026-04-02T17:59:48.742Z","repository":{"id":341547134,"uuid":"1170558447","full_name":"yaacov/kubectl-metrics","owner":"yaacov","description":"Query Prometheus / Thanos metrics on OpenShift clusters — as a CLI and an MCP server for AI assistants.","archived":false,"fork":false,"pushed_at":"2026-03-23T21:45:57.000Z","size":171,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-24T20:15:30.420Z","etag":null,"topics":["mcp-server","metrics","openshift","prometheus","prometheus-client","prometheus-monitoring","thanos"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yaacov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-02T09:01:20.000Z","updated_at":"2026-03-23T21:46:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/yaacov/kubectl-metrics","commit_stats":null,"previous_names":["yaacov/metrics-mcp"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/yaacov/kubectl-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaacov%2Fkubectl-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaacov%2Fkubectl-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaacov%2Fkubectl-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaacov%2Fkubectl-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yaacov","download_url":"https://codeload.github.com/yaacov/kubectl-metrics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaacov%2Fkubectl-metrics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31312744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mcp-server","metrics","openshift","prometheus","prometheus-client","prometheus-monitoring","thanos"],"created_at":"2026-03-14T12:20:41.336Z","updated_at":"2026-04-02T17:59:48.735Z","avatar_url":"https://github.com/yaacov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubectl-metrics\n\nQuery Prometheus / Thanos metrics on OpenShift clusters — as a CLI and an MCP server for AI assistants.\n\n## Installation\n\nInstall the latest release (Linux / macOS):\n\n```bash\ncurl -sSL https://raw.githubusercontent.com/yaacov/kubectl-metrics/main/install.sh | bash\n```\n\nThis downloads the binary, verifies its checksum, and sets up shell completion. Installs to `~/.local/bin` by default.\n\nOr install with [Krew](https://krew.sigs.k8s.io/) (kubectl plugin manager):\n\n```bash\nkubectl krew install mtv-metrics\n```\n\nOr build from source:\n\n```bash\nmake build\ncp kubectl-metrics ~/.local/bin/kubectl-metrics\n```\n\nOnce installed, kubectl discovers it as a plugin:\n\n```bash\nkubectl metrics --help\n```\n\nFor more options (manual download, shell completion, uninstall), see [Installation](docs/installation.md).\n\n[![asciicast](https://asciinema.org/a/TKJnpVPAZtJiaBsB.svg)](https://asciinema.org/a/TKJnpVPAZtJiaBsB)\n\n## Quick Start\n\n```bash\n# CLI usage (auto-discovers Prometheus from your kubeconfig)\nkubectl metrics discover\nkubectl metrics discover --keyword mtv\nkubectl metrics query --query \"up\"\nkubectl metrics query --query \"sum(rate(http_requests_total[5m])) by (code)\" --name http_rps\nkubectl metrics query-range --query \"rate(http_requests_total[5m])\" --start \"-1h\"\nkubectl metrics query-range \\\n  --query \"sum(rate(container_cpu_usage_seconds_total[5m])) by (namespace)\" \\\n  --query \"sum(container_memory_working_set_bytes) by (namespace)\" \\\n  --name cpu --name mem --start \"-1h\"\nkubectl metrics preset --name mtv_migration_status\n\n# MCP server (stdio, for Claude Desktop / Cursor IDE)\nkubectl metrics mcp-server\n\n# MCP server (SSE, for OpenShift Lightspeed)\nkubectl metrics mcp-server --sse --port 8080\n\n# MCP server from container image\npodman run --rm -p 8080:8080 \\\n  -e MCP_KUBE_SERVER=https://api.mycluster.example.com:6443 \\\n  -e MCP_KUBE_TOKEN=\"$(oc whoami -t)\" \\\n  quay.io/yaacov/kubectl-metrics-mcp-server:latest\n```\n\n## AI Assistant Setup\n\n**Claude Desktop:**\n\n```bash\nclaude mcp add kubectl-metrics kubectl metrics mcp-server\n```\n\n**Cursor IDE:**\n\nSettings → MCP → Add Server → Name: `kubectl-metrics`, Command: `kubectl`, Args: `metrics mcp-server`\n\n## Authentication\n\nUses standard kubectl flags (`--kubeconfig`, `--context`, `--token`, `--server`). Auto-discovers the Prometheus/Thanos URL from the cluster's thanos-querier route.\n\nFor client certificate auth (e.g. Kind/minikube), automatically requests a service account token via the Kubernetes TokenRequest API.\n\n## Deploy on OpenShift\n\n```bash\nmake deploy              # Deployment + Service\nmake deploy-route        # External Route with TLS\nmake deploy-olsconfig    # Register with OpenShift Lightspeed\n```\n\n## Similar Tools\n\nSeveral other tools exist for querying Prometheus from the command line.\n**promtool** (official Prometheus CLI) and **promql-cli** offer standalone PromQL querying,\n**prometheus-mcp-server** exposes Prometheus to AI assistants via MCP, and\n**kubectl-prom** is a lightweight kubectl plugin for in-cluster queries.\n\nkubectl-metrics combines all three angles — kubectl-native CLI, OpenShift/Thanos auto-discovery with preset queries, and a built-in MCP server — in a single binary.\nSee [Similar Tools](docs/similar-tools.md) for a detailed comparison.\n\n## Documentation\n\nSee the [docs/](docs/) directory for detailed guides:\n\n**Getting started**\n- [Installation](docs/installation.md) — install, Krew, shell completion\n- [CLI Usage](docs/cli-usage.md) — commands, flags, presets, output formats\n- [PromQL Reference](docs/promql-reference.md) — query language cheat sheet\n\n**Querying guides**\n- [Query Cookbook](docs/query-cookbook.md) — recipes for storage, network, pods, and migrations\n- [VM \u0026 Migration Cookbook](docs/vm-migration-cookbook.md) — per-migration monitoring, per-disk I/O, KubeVirt VM metrics\n- [Metrics Reference](docs/metrics-reference.md) — metric names and label tables\n\n**MCP and AI integration**\n- [MCP Server](docs/mcp-server.md) — stdio and SSE modes, AI assistant setup\n- [Containerized](docs/containerized.md) — running the MCP server from a container image\n\n**Operations**\n- [Authentication](docs/authentication.md) — kubeconfig, client certs, TokenRequest\n- [Deployment](docs/deployment.md) — deploy on OpenShift, Lightspeed integration\n\n**Comparison**\n- [Similar Tools](docs/similar-tools.md) — feature comparison with other tools\n\n## Development\n\n```bash\nmake help          # Show all targets\nmake build         # Build binary\nmake test          # Run tests\nmake fmt           # Format code\nmake lint          # Run linters (requires: make install-tools)\nmake vendor        # Populate vendor/\nmake image-build-amd64   # Build container image\n```\n\n## License\n\nApache License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaacov%2Fkubectl-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyaacov%2Fkubectl-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaacov%2Fkubectl-metrics/lists"}