{"id":16408812,"url":"https://github.com/sysnet4admin/kubefin","last_synced_at":"2026-06-27T23:31:19.863Z","repository":{"id":63741648,"uuid":"570349396","full_name":"sysnet4admin/kubefin","owner":"sysnet4admin","description":"kubernetes finalize ","archived":false,"fork":false,"pushed_at":"2022-11-25T01:39:52.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T00:44:43.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/sysnet4admin.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}},"created_at":"2022-11-25T00:55:07.000Z","updated_at":"2022-11-25T01:03:16.000Z","dependencies_parsed_at":"2022-11-25T02:35:37.824Z","dependency_job_id":null,"html_url":"https://github.com/sysnet4admin/kubefin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sysnet4admin/kubefin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysnet4admin%2Fkubefin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysnet4admin%2Fkubefin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysnet4admin%2Fkubefin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysnet4admin%2Fkubefin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysnet4admin","download_url":"https://codeload.github.com/sysnet4admin/kubefin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysnet4admin%2Fkubefin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34872279,"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-27T02:00:06.362Z","response_time":126,"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":"2024-10-11T06:17:58.519Z","updated_at":"2026-06-27T23:31:19.847Z","avatar_url":"https://github.com/sysnet4admin.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `ctx-cleaner`: Easy to clean up garbage on contexts\n\n[![version](https://img.shields.io/badge/version-0.1-yellow.svg)](https://semver.org)\n![Proudly written in Bash](https://img.shields.io/badge/written%20in-bash-ff69b4.svg)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## **`ctx-cleaner`** DEMO \n![ctx-cleaner-demo GIF](img/ctx-cleaner-demo.gif)\n\n-----\n\n## Environment\n\nkubectl \u003e= 1.5.x\n```bash\nkubectl version --client\nClient Version: version.Info{Major:\"1\", Minor:\"23\", GitVersion:\"v1.23.1\", GitCommit:\"86ec240af8cbd1b60bcc4c03c20da9b98005b92e\", GitTreeState:\"clean\", BuildDate:\"2021-12-16T11:33:37Z\", GoVersion:\"go1.17.5\", Compiler:\"gc\", Platform:\"darwin/amd64\"}\n```\n\nIn versions of kubectl less than 1.5, an error occurs because the `kubectl config get-users` command cannot be found among the execution contents.\n\n\n## Purpose \nWhen k8s Contexts are not matched to Clusters or Users like below: \u003cbr/\u003e\n(i.e. if you remove contexts, clusters \u0026 users cannot remove automatically)\n\n#### k8s Contexts\n```bash \n$ kubectl config get-contexts\nCURRENT   NAME   CLUSTER                                          AUTHINFO                                         NAMESPACE\n          aks    aks                                              clusterUser_res_aks                              default\n          eks    arn:aws:eks:us-east-2:443308097684:cluster/eks   arn:aws:eks:us-east-2:443308097684:cluster/eks\n          gke    gke_hj-int-20200908_us-central1-c_gke            gke_hj-int-20200908_us-central1-c_gke\n          nks    kubernetes                                       kubernetes-admin\n```\n\n#### k8s Clusters \n```bash \n$ kubectl config get-clusters\nNAME\naks\narn:aws:eks:us-east-2:443308097684:cluster/eks\ngke_20200512_us-central1-c_beer\ngke_20200512_us-central1-c_bread\ngke_20200512_us-central1-c_coffee\ngke_hj-int-20200908_us-central1-c_gke\nkubernetes\n```\n\n-----\n\n## Usage\n\n```bash\n$ ctx-cleaner \ndeleted cluster gke_20200512_us-central1-c_beer from /Users/mz01-hj/.kube/config\ndeleted cluster gke_20200512_us-central1-c_bread from /Users/mz01-hj/.kube/config\ndeleted cluster gke_20200512_us-central1-c_coffee from /Users/mz01-hj/.kube/config\ndeleted user gke_20200512_us-central1-c_beer from /Users/mz01-hj/.kube/config\ndeleted user gke_20200512_us-central1-c_bread from /Users/mz01-hj/.kube/config\ndeleted user gke_20200512_us-central1-c_coffee from /Users/mz01-hj/.kube/config\n```\n\n-----\n\n## Installation\n\n### Add other method later \n\n### One time runner \n```bash \n$ curl https://raw.githubusercontent.com/sysnet4admin/kubefin/main/kubefin \u003cnamespace's name\u003e| bash\n```\n\n### Manual Installation (macOS and Linux)\nSince ctx-cleaner is written in Bash, you should be able to install \nthem to any POSIX environment that has Bash installed\n\n- Download the `ctx-cleaner` scripts.\n- Either:\n  - save them all to somewhere in your `PATH`,\n  - or save them to a directory, then create symlinks to `ctx-cleaner` from\n    somewhere in your `PATH`, like `/usr/local/bin`\n- Make `ctx-cleaner` executable (`chmod +x ...`)\n\nExample installation steps:\n\n```bash\n$ sudo git clone https://github.com/sysnet4admin/ctx-cleaner.git /opt/ctx-cleaner\n$ sudo ln -s /opt/ctx-cleaner /usr/local/bin/ctx-cleaner\n```\n\n**OR**\n\n```bash\n$ curl https://raw.githubusercontent.com/sysnet4admin/kubefin/main/kubefin -o /usr/local/bin/ctx-cleaner\n$ chmod +x /usr/local/bin/ctx-cleaner\n```\n\n-----\n\n## Uninstall ctx-cleaner\n\n```bash\n$ rm -rf /opt/ctx-cleaner \n$ rm -f /usr/local/bin/ctx-cleaner \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysnet4admin%2Fkubefin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysnet4admin%2Fkubefin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysnet4admin%2Fkubefin/lists"}