{"id":27393765,"url":"https://github.com/jhrv/kubeaware","last_synced_at":"2025-04-13T22:15:51.653Z","repository":{"id":29466974,"uuid":"121770486","full_name":"jhrv/kubeaware","owner":"jhrv","description":"kubernetes context awareness","archived":false,"fork":false,"pushed_at":"2019-01-31T07:02:58.000Z","size":111,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T22:15:31.163Z","etag":null,"topics":["bash","kubectl","kubernetes","ps1","zsh"],"latest_commit_sha":null,"homepage":"","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/jhrv.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}},"created_at":"2018-02-16T16:05:50.000Z","updated_at":"2021-01-19T14:43:40.000Z","dependencies_parsed_at":"2022-08-07T14:16:35.254Z","dependency_job_id":null,"html_url":"https://github.com/jhrv/kubeaware","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/jhrv%2Fkubeaware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhrv%2Fkubeaware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhrv%2Fkubeaware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhrv%2Fkubeaware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhrv","download_url":"https://codeload.github.com/jhrv/kubeaware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788810,"owners_count":21161728,"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":["bash","kubectl","kubernetes","ps1","zsh"],"created_at":"2025-04-13T22:15:50.403Z","updated_at":"2025-04-13T22:15:51.600Z","avatar_url":"https://github.com/jhrv.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubeaware\n\nA simpler Kubernetes context awareness helper for bash and zsh\n\nComplements the [kubectx and kubens tools](https://github.com/ahmetb/kubectx) by [ahmetb](https://github.com/ahmetb)\n\n## Usage\n\n![usage_demo](img/usage.gif)\n\n```\nUsage: kube[un]aware [-g | --global] [-h | --help]\n\nWith no arguments, turn on/off kubeaware for this shell instance instance (default).\n\n  -g --global  turn on kubeawareness globally\n  -h --help    print this message\n```\n\n## Installation\n\n### Bash\n```\nsource kubeaware.sh\nexport PS1=\"[your prompt] \\$(kubeaware_prompt)$ \"\n```\n\n![installation_demo](img/installation.gif)\n\n### Zsh\n```\nsource kubeaware.sh\nPROMPT='$(kubeaware_prompt) '$PROMPT\n```\n\n\nInclude this in your `~/.bashrc` or `~/.zshrc`to load each time you start a new shell\n\n### Remove Kubernetes-logo\n\nAdd the following line after `source`, if you want to remove the Kubernetes-logo:\n```\nunset KUBE_SYMBOL PRE_SYMBOL POST_SYMBOL\n```\n\n## How it works\n\nWhen kubeaware.sh is sourced, mainly two things happen:\n- You load a set of helper functions, most importantly `kubeaware` which is used in your `$PS1` environment variable\n- The environment variable `$PROMPT_COMMAND` in bash is patched with the function that gets the context info from Kubernetes. For ZSH the functionality is added via add-zsh-hook precmd.\n\nThe function(s) included in `$PROMPT_COMMAND` is executed each time your shell runs a command.\n\nThe function included by kubeaware will fetch the information from the `KUBECONFIG` file (via `kubectl config`). This will only happen if `KUBECONFIG` has changed since last time it was checked.\n\n## Acknowledgements\n\nHeavily inspired by [kube-ps1](https://github.com/jonmosco/kube-ps1) by [jonmosco](https://github.com/jonmosco), and aims to contain only a subset of the features\n\n## Contributors\n- [Frode Sundby](https://github.com/frodesundby)\n- [Vegar Sechmann Molvig](https://github.com/VegarM)\n- [Kyrre Havik Eriksen](https://github.com/kyrremann)\n\n## Known issues\n\nHas not been tested versions of bash \u003c 4.x, so there might be compatability issues if you are running an older version\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhrv%2Fkubeaware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhrv%2Fkubeaware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhrv%2Fkubeaware/lists"}