{"id":13522205,"url":"https://github.com/weibeld/kubectl-ns","last_synced_at":"2025-07-21T17:32:47.528Z","repository":{"id":80554569,"uuid":"169795135","full_name":"weibeld/kubectl-ns","owner":"weibeld","description":"A kubectl plugin for interactively switching between namespaces in your cluster","archived":false,"fork":false,"pushed_at":"2022-12-29T11:40:39.000Z","size":87,"stargazers_count":36,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-04T11:34:37.326Z","etag":null,"topics":["kubectl","kubectl-plugins","kubernetes"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/weibeld.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}},"created_at":"2019-02-08T20:32:41.000Z","updated_at":"2024-12-19T15:57:24.000Z","dependencies_parsed_at":"2023-03-13T20:09:30.058Z","dependency_job_id":null,"html_url":"https://github.com/weibeld/kubectl-ns","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/weibeld/kubectl-ns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weibeld%2Fkubectl-ns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weibeld%2Fkubectl-ns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weibeld%2Fkubectl-ns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weibeld%2Fkubectl-ns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weibeld","download_url":"https://codeload.github.com/weibeld/kubectl-ns/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weibeld%2Fkubectl-ns/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266342809,"owners_count":23914262,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["kubectl","kubectl-plugins","kubernetes"],"created_at":"2024-08-01T06:00:44.037Z","updated_at":"2025-07-21T17:32:47.508Z","avatar_url":"https://github.com/weibeld.png","language":"Shell","funding_links":[],"categories":["kubectl Plugins"],"sub_categories":["Installing plugins via awesome-kubectl-plugins"],"readme":"# kubectl ns\n\nA [kubectl plugin](https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/) for interactively switching the current namespace:\n\n![Demo](img/demo.gif)\n\nThis makes it easier to work with different namespaces in the same cluster.\n\nAlso see [kubectl-ctx](https://github.com/weibeld/kubectl-ctx) for switching between contexts (e.g. clusters).\n\n## Installation\n\nYou can install the plugin by following these simple steps:\n\n1. Download the `kubectl-ns` script:\n\n    ~~~bash\n    curl -O https://raw.githubusercontent.com/weibeld/kubectl-ns/master/kubectl-ns\n    ~~~\n\n2. Make it executable:\n\n    ~~~bash\n    chmod +x kubectl-ns\n    ~~~\n    \n3. Move it to *any* directory in your `PATH` (you might want to create a `~/.kubectl-plugins` folder for all your kubectl plugins):\n\n    ~~~bash\n    mv kubectl-ns ~/.kubectl-plugins\n    ~~~~\n\nNow, you can verify that the plugin is correctly installed by running the following command and checking that the `kubectl-ns` script is included in the output:\n\n~~~bash\nkubectl plugin list\n~~~~\n\nTo uninstall the plugin, simply delete the `kubectl-ns` script.\n\n## Dependencies\n\nThe plugin depends on the [fzf](https://github.com/junegunn/fzf) command being available on your system.\n\nYou can install fzf as follows:\n\n- Homebrew (macOS) and Linuxbrew (Linux):\n    ~~~bash\n    brew install fzf\n    ~~~\n- From source (macOS and Linux):\n    ~~~bash\n    git clone https://github.com/junegunn/fzf.git ~/.fzf\n    ~/.fzf/install\n    ~~~\n- For further installation options, see [here](https://github.com/junegunn/fzf#installation)\n\n## Usage\n\nInteractively change the current namespace:\n\n~~~bash\nkubectl ns\n~~~\n\nList all namespaces:\n\n~~~bash\nkubectl ns -l\n~~~\n\nUpdate the namespaces cache:\n\n~~~bash\nkubectl ns -u\n~~~\n\n### Cache\n\nThe cache feature speeds up the `kubectl ns` and `kubectl ns -l` commands.\n\nThis is because these commands need to retrieve the full list of namespaces, which is usually only stored in the cluster and thus needs to be retrieved from the API server. Without the cache, these commands would take as long as it takes to execute `kubectl get namespaces`. With the cache, they are blazingly fast, as they get the full list of namespaces from the local cache rather than from the API server.\n\nThe cache is created automatically when running `kubectl ns` or `kubectl ns -l` for the first time with a given cluster (cache location is `~/.kube/kubectl-ns`). You can manually update the cache at any time by running `kubectl ns -u`.\n\nNote that there are no automatic updates of the cache, so you should run `kubectl ns -u` whenever you create or delete namespaces.\n\n## How It Works\n\nWhen you run `kubectl ns`, the plugin changes your local [*kubeconfig*](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) configuration as shown below:\n\n![How it works](img/how-it-works.png)\n\nAs you can see, the plugin changes the **namespace** element of the **current context** in your *kubeconfig* configuration (the plugin always works on the current context).\n\nThis means that the next time you use `kubectl`, it will use the new namespace for the same cluster.\n\nNote that the `ns` command physically changes one of your *kubeconfig* files (the default *kubeconfig* file is `~/.kube/config`, but you can have multiple *kubeconfig* files by by listing them in the [`KUBECONFIG`](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#the-kubeconfig-environment-variable) environment variable).\n\nThe `ns -l` command displays the namespaces of the **cluster** which is referenced by your current context.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweibeld%2Fkubectl-ns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweibeld%2Fkubectl-ns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweibeld%2Fkubectl-ns/lists"}