{"id":50529431,"url":"https://github.com/bazelment/kq","last_synced_at":"2026-06-03T11:31:07.589Z","repository":{"id":359725248,"uuid":"1247273510","full_name":"bazelment/kq","owner":"bazelment","description":"query k8s objects snapshot without a database","archived":false,"fork":false,"pushed_at":"2026-05-23T05:25:14.000Z","size":271,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-23T07:23:59.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/bazelment.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-23T05:20:24.000Z","updated_at":"2026-05-23T05:25:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bazelment/kq","commit_stats":null,"previous_names":["bazelment/kq"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bazelment/kq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelment%2Fkq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelment%2Fkq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelment%2Fkq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelment%2Fkq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazelment","download_url":"https://codeload.github.com/bazelment/kq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelment%2Fkq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33863265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-03T11:31:06.508Z","updated_at":"2026-06-03T11:31:07.573Z","avatar_url":"https://github.com/bazelment.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kq\n\nFast SQL for Kubernetes cluster snapshots.\n\nkq loads a point-in-time dump of your cluster's resources into Apache Arrow\ntables and lets you query it with SQL. Use it for offline cluster analysis,\ncapacity reviews, debugging large clusters, and — by labelling each capture —\ncomparing snapshots side by side. No database to stand up, no live API server\nload.\n\n## Features\n\n- Query `pods`, `nodes`, `namespaces`, and `daemon_sets` with SQL.\n- Work offline from a snapshot file — no cluster connection while you query.\n- Load many snapshots at once; the `pods` and `nodes` views carry a `cluster`\n  column you set at capture time, so you can group and compare across them.\n- Reach nested Kubernetes fields directly: `metadata.name`, `spec['nodeName']`,\n  `status.phase`.\n- Kubernetes-aware SQL functions for CPU, memory, containers, and node pools.\n- Interactive shell, one-shot queries, and machine-readable batch output.\n\n## Quick Start\n\nYou need [Bazel](https://bazel.build) 7.x to build kq. To capture a snapshot\nfrom a live cluster you also need `kubectl` with cluster credentials and `jq`;\nif you don't have a cluster, skip to [No cluster handy?](#no-cluster-handy)\nbelow. Commands below assume Linux or macOS (use WSL on Windows) and are run\nfrom the repo root.\n\n```bash\n# Build the CLI (output: bazel-bin/kq/kq).\nbazel build -c opt //kq:kq\n\n# Capture a snapshot of your cluster. The top-level `timestamp` is required.\n# Setting `cluster` on pods and nodes (the two views with a `cluster` column)\n# lets you tell snapshots apart when you load several at once.\nkubectl get pods,nodes,namespaces,daemonsets --all-namespaces -o json \\\n  | jq '{\n      timestamp: (now | todateiso8601),\n      pods:       [.items[] | select(.kind==\"Pod\")       | .cluster = \"prod-us\"],\n      nodes:      [.items[] | select(.kind==\"Node\")       | .cluster = \"prod-us\"],\n      namespaces: [.items[] | select(.kind==\"Namespace\")],\n      daemonSets: [.items[] | select(.kind==\"DaemonSet\")]\n    }' \\\n  \u003e cluster.json\n\n# Query it.\nbazel-bin/kq/kq --query \"\nSELECT phase, COUNT(*) AS pods FROM pods GROUP BY phase ORDER BY pods DESC\n\" cluster.json\n\n# Or explore interactively.\nbazel-bin/kq/kq cluster.json\n```\n\nInside the interactive shell — the startup banner lists the loaded views:\n\n```sql\nDESCRIBE pods;\nSELECT metadata.name, metadata.namespace, spec['nodeName']\nFROM pods\nLIMIT 10;\n```\n\nFor the full SQL reference, snapshot formats, and conversion tools, see the\n[Usage guide](docs/USAGE.md).\n\n## No cluster handy?\n\nTo try kq, learn the SQL, or benchmark without a real cluster, generate a\nsynthetic snapshot:\n\n```bash\nbazel run -c opt //kq/tools:synthetic_snapshot -- \\\n  --output /tmp/kq-demo --cluster demo --nodes 100 --namespaces 20 --overwrite\n\nbazel-bin/kq/kq /tmp/kq-demo\n```\n\nThe generator produces deterministic, realistic clusters of any size — see\n[Trying kq without a cluster](docs/USAGE.md#trying-kq-without-a-cluster).\n\nFor a one-shot tour of multi-cluster SQL — generate N synthetic clusters and\nrun seven typical fleet-investigation queries against them — run\n[`scripts/demo_synthetic_multicluster_queries.sh`](scripts/demo_synthetic_multicluster_queries.sh)\n(`--help` for options).\n\n## Documentation\n\n- [Usage guide](docs/USAGE.md) — capturing snapshots, CLI modes, SQL syntax,\n  conversion tools.\n- [Developer guide](docs/DEVELOPMENT.md) — code layout, build/test workflow,\n  dependency management.\n- [Benchmarks](docs/BENCHMARKS.md) — repeatable loader, query, and memory\n  profiles.\n- [Contributing](CONTRIBUTING.md) — ground rules, public-data policy, PR\n  checklist.\n- [Getting started as a contributor](docs/GETTING-STARTED-CONTRIBUTING.md)\n  ([中文](docs/GETTING-STARTED-CONTRIBUTING-cn.md)) — on-ramp for\n  first-time contributors with a curated list of good first projects.\n\n## License\n\nApache-2.0. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelment%2Fkq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazelment%2Fkq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelment%2Fkq/lists"}