{"id":20178517,"url":"https://github.com/nvtkaszpir/k8s-describe-nodes-parser","last_synced_at":"2026-05-06T13:14:25.164Z","repository":{"id":146355551,"uuid":"340490247","full_name":"nvtkaszpir/k8s-describe-nodes-parser","owner":"nvtkaszpir","description":"Parse kubectl describe nodes and output as json","archived":false,"fork":false,"pushed_at":"2021-02-20T10:20:24.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-13T16:48:52.225Z","etag":null,"topics":["json","kubernetes","parse","parser","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nvtkaszpir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2021-02-19T21:09:29.000Z","updated_at":"2021-02-27T08:16:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"598ea26f-64ec-451e-ae46-3bc9c3f70e8c","html_url":"https://github.com/nvtkaszpir/k8s-describe-nodes-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvtkaszpir%2Fk8s-describe-nodes-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvtkaszpir%2Fk8s-describe-nodes-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvtkaszpir%2Fk8s-describe-nodes-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvtkaszpir%2Fk8s-describe-nodes-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvtkaszpir","download_url":"https://codeload.github.com/nvtkaszpir/k8s-describe-nodes-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241613337,"owners_count":19991036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["json","kubernetes","parse","parser","python","python3"],"created_at":"2024-11-14T02:21:26.400Z","updated_at":"2026-05-06T13:14:20.123Z","avatar_url":"https://github.com/nvtkaszpir.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# k8s-describe-nodes-parser\n\nSome simple dumb python script to parse `kubectl describe nodes`,\ntailored to parse nvidia gpu-feature-discovery output.\nReturns output as JSON, for easier parsing.\n\ntl;dr:\nI had to do some simple detection if env will fit in k8s cluster with\nnvidia gpus, so this is a small helper script.\n\nThe superpowers of bash comes when you mix it with `jq`:\n\n```bash\n$ python3 k8s_resources.py --input data/nodes-fake.txt | jq '[.[]|.gpu.requests]|add'\n0\n```\n\n## Example\n\nSee [data/](data/) directory for input and output.\n\n```bash\npython3 k8s_resources.py --input data/nodes-fake.txt  \u003e data/output.json\n```\n\nExample output (snippet):\n\n```text\n[\n  {\n    \"name\": \"alpha\",\n    \"cpu\": {\n      \"requests\": \"925m\",\n      \"requests_percent\": 10,\n      \"limits\": \"3\",\n      \"limits_percent\": 33\n    },\n    \"mem\": {\n      \"requests\": \"1869366Ki\",\n      \"requests_percent\": 3,\n      \"limits\": \"6315402496\",\n      \"limits_percent\": 10\n    },\n    \"gpu\": {\n      \"requests\": 0,\n      \"limits\": 0\n    },\n    \"ephemeral-storage\": {\n      \"requests\": \"0\",\n      \"requests_percent\": 0,\n      \"limits\": \"0\",\n      \"limits_percent\": 0\n    },\n    \"hugepages-2Mi\": {\n      \"requests\": \"0\",\n      \"requests_percent\": 0,\n      \"limits\": \"0\",\n      \"limits_percent\": 0\n    },\n    \"hugepages-1Gi\": null\n  },\n  {\n    \"name\": \"bravo\",\n    \"cpu\": {\n      \"requests\": \"725m\",\n      \"requests_percent\": 8,\n      \"limits\": \"2\",\n      \"limits_percent\": 22\n    },\n    \"mem\": {\n      \"requests\": \"1345078Ki\",\n      \"requests_percent\": 2,\n      \"limits\": \"5241660672\",\n      \"limits_percent\": 8\n    },\n    \"gpu\": {\n      \"requests\": 0,\n      \"limits\": 0\n    },\n    \"ephemeral-storage\": {\n      \"requests\": \"0\",\n      \"requests_percent\": 0,\n      \"limits\": \"0\",\n      \"limits_percent\": 0\n    },\n    \"hugepages-2Mi\": {\n      \"requests\": \"0\",\n      \"requests_percent\": 0,\n      \"limits\": \"0\",\n      \"limits_percent\": 0\n    },\n    \"hugepages-1Gi\": null\n  }\n]\n```\n\n## References\n\n* [jq](https://stedolan.github.io/jq/)\n* [python3](https://pythonclock.org/)\n\n## Contributing\n\nYeah you can try, but be prepared that they will be rejected.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvtkaszpir%2Fk8s-describe-nodes-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvtkaszpir%2Fk8s-describe-nodes-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvtkaszpir%2Fk8s-describe-nodes-parser/lists"}