{"id":27692423,"url":"https://github.com/eth-p/kubesel","last_synced_at":"2026-05-16T08:10:24.676Z","repository":{"id":286514767,"uuid":"961624848","full_name":"eth-p/kubesel","owner":"eth-p","description":"A modern approach to managing kubectl in multi-cluster environments.","archived":false,"fork":false,"pushed_at":"2025-05-21T02:06:56.000Z","size":220,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-21T03:23:57.487Z","etag":null,"topics":["kubeconfig","kubeconfig-manager","kubectl","kubectx","kubens","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eth-p.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}},"created_at":"2025-04-06T22:16:47.000Z","updated_at":"2025-05-21T02:06:59.000Z","dependencies_parsed_at":"2025-05-05T01:27:52.582Z","dependency_job_id":"3a7a014a-0729-4779-8032-2944a7693f67","html_url":"https://github.com/eth-p/kubesel","commit_stats":null,"previous_names":["eth-p/kubesel"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/eth-p/kubesel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-p%2Fkubesel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-p%2Fkubesel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-p%2Fkubesel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-p%2Fkubesel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eth-p","download_url":"https://codeload.github.com/eth-p/kubesel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-p%2Fkubesel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265508103,"owners_count":23779073,"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":["kubeconfig","kubeconfig-manager","kubectl","kubectx","kubens","kubernetes"],"created_at":"2025-04-25T11:54:08.713Z","updated_at":"2026-05-16T08:10:19.657Z","avatar_url":"https://github.com/eth-p.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Kubesel (**kube**config **sel**ector) is your modern approach to working with\n[kubectl](https://kubernetes.io/docs/reference/kubectl/) configuration in a\nmulti-cluster, multi-namespace environment. Quickly and easily change your\nactive kubectl context, namespace, and cluster through a single program.\n\n[![Latest Version](https://img.shields.io/github/v/release/eth-p/kubesel?display_name=tag\u0026style=flat-square\u0026label=version)](https://github.com/eth-p/kubesel/releases/latest)\n[![MIT License](https://img.shields.io/github/license/eth-p/kubesel?style=flat-square)](https://github.com/eth-p/kubesel/blob/master/LICENSE)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/eth-p/kubesel/.github%2Fworkflows%2Fbuild.yaml?branch=master\u0026event=push\u0026style=flat-square\u0026logo=github)](https://github.com/eth-p/kubesel/actions/workflows/build.yaml?query=branch:master)\n[![Nix Flake Installation](https://img.shields.io/badge/flake-github%3Aeth--p%2Fkubesel-%235277C3?style=flat-square\u0026logo=nixos\u0026logoColor=%23ffffff)](#with-nix)\n[![Go Reference](https://img.shields.io/badge/-reference-%2300ADD8?style=flat-square\u0026logo=go\u0026logoColor=%23ffffff)](https://pkg.go.dev/github.com/eth-p/kubesel/pkg/kubesel)\n\n![Screenshot of kubesel](./screenshots/example.png)\n\nDesigned from the ground up using the [KUBECONFIG environment variable](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#the-kubeconfig-environment-variable),\nkubesel creates and manages a unique kubeconfig file for each shell session.\nIf you change your cluster in one pane, it won't affect the other pane where\nyou were planning on running `kubectl delete`.\n\n\n---\n\n**Table of Contents:**\n\n - [Installation](#installation)\n   - [Setup](#setup)\n - [Features](#features)\n - [Usage](#usage)\n - [Tips](#tips)\n   - [List Output Formats](#list-output-formats)\n   - [Adding Kubeconfig Files From a Directory](#adding-kubeconfig-files-from-a-directory)\n - [Alternatives](#alternatives)\n\n---\n\n## Installation\n\n### With Go\n\n```bash\ngo install github.com/eth-p/kubesel\n```\n\n### With Nix\n```bash\nnix profile install github:eth-p/kubesel\n```\n\n### Setup\n\nFor kubesel to set contexts/namespaces per shell, it needs to be able to\ngenerate and manage a kubeconfig file associated with specific instances\nof the shell. To do this, `kubesel init` creates a shell script that\nwill generate the file and update the `KUBECONFIG` environment variable.\n\nWhile you can run the command manually, it is **highly** recommended to set\nup your `.profile`/`.rc` files to automatically run it whenever a new\ninteractive shell is created. Doing it this way eliminates the risk of multiple\nshells accidentally sharing the same kubesel-managed kubeconfig file.\n\n\u003e [!note]\n\u003e The `KUBECONFIG` environment variable should be set *before* `kubesel init`\n\u003e is run.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eBash\u003c/b\u003e\u003c/summary\u003e\n\nAdd this to `~/.bash_profile`:\n\n```bash\nif [[ $- = *i* ]]; then\n    source \u003c(kubesel init bash)\nfi\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eZsh\u003c/b\u003e\u003c/summary\u003e\n\nAdd this to `~/.zshrc`:\n\n```zsh\nsource \u003c(kubesel init zsh)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eFish\u003c/b\u003e\u003c/summary\u003e\n\nAdd this to `~/.config/fish/config.fish`:\n\n```fish\nif status is-interactive\n    kubesel init fish | source\nend\n```\n\n\u003c/details\u003e\n\n\n## Features\n\n - [x] Per-shell context (cluster, user, and namespace).\n - [x] Supports\n       [bash](https://www.gnu.org/software/bash/),\n       [zsh](https://www.zsh.org/), and\n       [fish](https://fishshell.com/).\n - [x] Shell completions.\n - [x] Fuzzy matching contexts/clusters/users/namespaces.\n - [x] A fzf interface for picking contexts/clusters/users/namespaces.\n - [x] Preserves OIDC authentication refresh tokens.\n - [x] Shell-scripting friendly `list` subcommand.\n - [x] Manual pages.\n - [x] Fancy ANSI colors! (optional)\n\n## Usage\n\n**Change Cluster, User, or Namespace:**\n```bash\nkubesel cluster my-cluster      # use this cluster\nkubesel user my-user            # use this user\nkubesel namespace my-namespace  # use this namespace\n```\n\n**Change Cluster, User, _and_ Namespace:**\n```bash\n# Use the cluster, user, and namespace from this context.\nkubesel context my-context\nkubesel context my-context -n # keep the current namespace\n```\n\n**View Contexts, Clusters, Users, or Namespaces:**\n```bash\nkubesel list clusters\nkubesel list contexts\nkubesel list users\nkubesel list namespaces\n```\n\n## Tips\n\n### List Output Formats\n\nThe `kubesel list` command supports changing its output format with `--output`.  \nSupported formats are:\n\n - `list` for just the names in an unsorted list\n - `table` for a table\n - `col` for columns\n - `col=COL1,COL2` for specific columns\n - `col=*` for _all_ columns\n\n### Adding Kubeconfig Files From a Directory\n\nIf you keep each cluster in a different kubeconfig file, you can have kubesel\nautomatically include them during initialization:\n\n```bash\nls ~/.kube/configs\n# prod.yaml\n# staging.yaml\n# dev.yaml\n# kind-myapp.yaml\n\n# Use the `--add-kubeconfigs` flag to include them with a glob pattern.\nkubesel init --add-kubeconfigs='~/.kube/configs/*.yaml'\n```\n\n## Alternatives\n\n### kubectx\nhttps://github.com/ahmetb/kubectx\n\n - ✅ Shell completions.\n - ✅ Fuzzy-finding.\n - ⚠️ Changes affect all shells.\n\n### kubesess\nhttps://github.com/Ramilito/kubesess\n\n - ✅ Per-shell cluster/namespace/context.\n - ✅ Fuzzy-finding.\n - ⚠️ Does not support OIDC refresh tokens.\n\n### fish-kubeswitch\nhttps://github.com/eth-p/fish-kubeswitch\n\n - ✅ Per-shell cluster/namespace/context.\n - ✅ Shell completions.\n - ⚠️ Only supports [fish shell](https://fishshell.com/).\n - ⚠️ Wraps kubectl as a shell function.\n\n## Packaging\n\n### Go Build Tags\n\n - **`no_init_completions`**  \n   Removes shell completion loading from the `kubesel init` scripts.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feth-p%2Fkubesel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feth-p%2Fkubesel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feth-p%2Fkubesel/lists"}