{"id":37102827,"url":"https://github.com/radiusmethod/kxd","last_synced_at":"2026-01-14T12:27:31.480Z","repository":{"id":196173146,"uuid":"694843596","full_name":"radiusmethod/kxd","owner":"radiusmethod","description":"Kubeconfig file switcher","archived":false,"fork":false,"pushed_at":"2025-12-18T16:39:36.000Z","size":238,"stargazers_count":33,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-21T20:34:18.068Z","etag":null,"topics":["cli","go","kubeconfig","kubeconfig-manager","kubernetes","tools"],"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/radiusmethod.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-09-21T20:09:59.000Z","updated_at":"2025-12-04T02:41:24.000Z","dependencies_parsed_at":"2023-09-26T01:02:05.617Z","dependency_job_id":"12f02064-4f45-4208-b78f-82dd59a05032","html_url":"https://github.com/radiusmethod/kxd","commit_stats":null,"previous_names":["radiusmethod/kxd"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/radiusmethod/kxd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radiusmethod%2Fkxd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radiusmethod%2Fkxd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radiusmethod%2Fkxd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radiusmethod%2Fkxd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radiusmethod","download_url":"https://codeload.github.com/radiusmethod/kxd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radiusmethod%2Fkxd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","go","kubeconfig","kubeconfig-manager","kubernetes","tools"],"created_at":"2026-01-14T12:27:30.485Z","updated_at":"2026-01-14T12:27:31.434Z","avatar_url":"https://github.com/radiusmethod.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kxd - Kubeconfig Switcher\n\n\u003cimg src=\"assets/kxd.png\" width=\"200\"\u003e\n\nkxd is a command-line utility that allows you to easily switch between Kubernetes configuration files (kubeconfig) contexts. This tool is designed to simplify the management of multiple Kubernetes clusters and contexts.\n\n\u003cimg src=\"assets/demo.gif\" width=\"500\"\u003e\n\n## Features\n\n- Switch between different kubeconfig files.\n- Switch between Kubernetes contexts within a kubeconfig file.\n- Switch between Kubernetes namespaces in a context.\n\n## Table of Contents\n\n- [Installation](#installation)\n    - [Homebrew](#homebrew)\n    - [Makefile](#makefile)\n    - [To Finish Installation](#to-finish-installation)\n    - [Upgrading](#upgrading)\n    - [Configuration](#configuration)\n- [Usage](#usage)\n    - [Switching Kubeconfig Files](#switching-kubeconfig-files)\n    - [Switching Kubernetes Contexts](#switching-kubernetes-contexts)\n    - [Switching Kubernetes Context Namespaces](#switching-kubernetes-context-namespaces)\n    - [Getting Current Kubeconfig, Kubernetes Context or Context Namespace](#getting-current-kubeconfig-kubernetes-context-or-context-namespace)\n    - [Version](#version)\n    - [Persist KUBECONFIG across new shells](#persist-kubeconfig-across-new-shells)\n    - [Show your set kubeconfig in your shell prompt](#show-your-set-kubeconfig-in-your-shell-prompt)\n    - [Add autocompletion](#add-autocompletion)\n    - [TL;DR (full config example)](#tldr-full-config-example)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation\n\nMake sure you have Go installed. You can download it from [here](https://golang.org/dl/).\n\n### Homebrew\n\n```bash\nbrew tap radiusmethod/kxd\nbrew install kxd\n```\n\nor just\n\n```bash\nbrew install radiusmethod/kxd/kxd\n```\n### Makefile\n\n```bash\nmake install\n```\n\n### To Finish Installation\nAdd the following to your bash profile or zshrc then open new terminal or source that file\n\n```sh\nalias kxd=\"source _kxd\"\n```\n\nEx. `echo -ne '\\nalias kxd=\"source _kxd\"' \u003e\u003e ~/.zshrc`\n\n### Upgrading\nUpgrading consists of just doing a brew update and brew upgrade.\n\n```sh\nbrew update \u0026\u0026 brew upgrade radiusmethod/kxd/kxd\n```\n\n## Configuration\n\nBy default, Kubeconfig Switcher looks for files with an extension of `.conf`. You can customize the behavior by setting an environment variable.\nThis can be a single matcher or a comma seperated string for multiple matchers.\n\n- `KXD_MATCHER`: The file matcher(s) used to identify kubeconfig files (default is `.conf`).\n\n## Usage\n\n * See docs for more info [kxd](docs/kxd.md)\n\n### Switching Kubeconfig Files\n\nIt is possible to shortcut the menu selection by passing the config name you want to switch to as an argument.\n\n```bash\n\u003e kxd dev.conf\nConfig dev.conf set.\n```\n\nTo switch between different kubeconfig files using the menu, use the following command:\n\n```bash\nkxd f s\n```\n\nThis command will display a list of available kubeconfig files in your `~/.kube` directory. Select the one you want to use.\n\n### Switching Kubernetes Contexts\n\nTo switch between Kubernetes contexts within a kubeconfig file, use the following command:\n\n```bash\nkxd ctx s\n```\n\nThis command will display a list of available contexts in your current kubeconfig file. Select the one you want to switch to.\n\n### Switching Kubernetes Context Namespaces\n\nTo switch between Kubernetes context namespaces within a kubeconfig context, use the following command:\n\n```bash\nkxd ns s\n```\n\nThis command will display a list of kubernetes namespaces in your currently set cluster. Select the one you want to switch to.\n\n\n### Getting Current Kubeconfig, Kubernetes Context or Context Namespace\n\nTo get the currently set Kubeconfig, Kubernetes Context or Context Namespace, use the following commands:\n\n```bash\nkxd f c\n```\n\nThis command will display the currently set kubeconfig file.\n\n```bash\nkxd ctx c\n```\n\nThis command will display the currently set Kubernetes Context.\n\n```bash\nkxd ns c\n```\n\nThis command will display the currently set Kubernetes Context Namespace.\n\n### Version\n\nTo check the version of Kubeconfig Switcher, use the following command:\n\n```bash\nkxd version\n```\n\n## Persist KUBECONFIG across new shells\nTo persist the set config when you open new terminal windows, you can add the following to your bash profile or zshrc.\n\n```bash\nexport KUBECONFIG=$(kxd file current)\n```\n\n### Show your set kubeconfig in your shell prompt\nFor better visibility into what your shell is set to it can be helpful to configure your prompt to show the value of the env variable `KUBECONFIG`.\n\n\u003cimg src=\"assets/screenshot.png\" width=\"700\"\u003e\n\nHere's a sample of my zsh prompt config using oh-my-zsh themes\n\n```sh\n# Kubeconfig info\nlocal kxd_info='$(kxd_config)'\nfunction kxd_config {\n  local config=\"${KUBECONFIG:=}\"\n    if [ -z \"$config\" ]\n    then\n          echo -n \"\"\n    else\n          config=$(basename $config)\n          echo -n \"%{$fg_bold[blue]%}kx:(%{$fg[cyan]%}${config}%{$fg_bold[blue]%})%{$reset_color%} \"\n    fi\n}\n```\n\n```sh\nPROMPT='OTHER_PROMPT_STUFF $(kxd_info)'\n```\n\nTo include prompt support in OhMyZsh, add the following lines to your `~/.p10k.zsh` file:\n\n```sh\n# kxd prompts\ntypeset -g _kxd_config\ntypeset -g _kxd_basename=''\ntypeset -g _kxd_content=\"kx:(${_kxd_basename})\"\n\nfunction prompt_kxd() {\nlocal _kxd_config=\"${KUBECONFIG:=}\"\nif [ -z \"$_kxd_config\" ]\nthen\n  _kxd_basename=''\nelse\n  _kxd_basename=\"%F{cyan}$(basename $_kxd_config)%f\"\nfi\n\n_kxd_content=\"kx:(${_kxd_basename})\"\np10k segment -b 0 -f 4 -t ${_kxd_content}\n}\n\nfunction instant_prompt_kxd() {\np10k segment -b 0 -f 4 -t ${_kxd_content}\n}\n```\n\nThen add `kxd` to either your left or right prompt segments.\n\n\u003cimg src=\"assets/ohmyzsh-screenshot.png\" width=\"700\"\u003e\n\n## Add autocompletion\nYou can add autocompletion when passing config as argument by adding the following to your bash profile or zshrc file.\n`source _kxd_autocomplete`\n\nNow you can do `kxd my-k` and hit tab and if you had a config `my-kubeconfig` it would autocomplete and find it.\n\n## TL;DR (full config example)\n```sh\nalias kxd=\"source _kxd\"\nsource _kxd_autocomplete\nexport KXD_MATCHER=\"-config,.conf\"\nexport KUBECONFIG=$(kxd file current)\n```\n\n## Contributing\n\nIf you encounter any issues or have suggestions for improvements, please open an issue or create a pull request on [GitHub](https://github.com/radiusmethod/kxd).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradiusmethod%2Fkxd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradiusmethod%2Fkxd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradiusmethod%2Fkxd/lists"}