jonmosco / kube-ps1

Kubernetes prompt info for bash and zsh
Apache License 2.0
3.47k stars 349 forks source link

kubeon/kubeoff does not change prompt when added as oh-my-zsh plugin #168

Closed Chr1stian closed 1 year ago

Chr1stian commented 1 year ago

kubeon/kubeoff does not change prompt when added as oh-my-zsh plugin. Aka nothing happens.

Running PROMPT='$(kube_ps1)'$PROMPT changes the prompt, but only temporarily. Adding it to .zshrc does nothing

tidnav commented 1 year ago

Same issue here. Ubuntu 20.04

Chr1stian commented 1 year ago

Let me know if I should provide more information. Running Mac OS Ventura 13.1

jonmosco commented 1 year ago

This is an issue with the oh-my-zsh plugin. The plugin and this project are not always in sync. I will update the plugin with the newest version as soon as I get a chance.

Chr1stian commented 1 year ago

Do you recommend installing kube-ps1 another way than with the plugin then? I have come to rely heavily upon this awesome promt changer 🥇

matteosilv commented 1 year ago

adding

 PROMPT='$(kube_ps1)'$PROMPT

at the end of .zshrc works for me

Chr1stian commented 1 year ago

I don't know if it just has to be set after some specific line (probably relating to oh-my-zsh) like for example: eval "$(starship init zsh)" But anyways, putting PROMPT='$(kube_ps1)'$PROMPT At the last line of .zshrc worked for me as well now. Thanks matteo!

samurang87 commented 1 year ago

I have the same problem atm (MacOS) and putting PROMPT='$(kube_ps1)'$PROMPT at the end doesn't do anything 😕

naviat commented 1 year ago

I have the same problem atm (MacOS) and putting PROMPT='$(kube_ps1)'$PROMPT at the end doesn't do anything 😕

Did you try to run kubeon -g command? @samurang87

jonmosco commented 1 year ago

I'm not sure what your configuration looks like, but testing the prompt with the latest version of oh-my-zsh works for me on MacOS, and on MacOS in a containerized environment. The readme suggests to try your configuration with a minimal config to help debug: https://github.com/jonmosco/kube-ps1#bug-reports-and-shell-configuration

There are other factors to consider as well: do you have your kubeconfig file, kubectl installed, prompt initialization configured correctly, etc?

oh-my-zsh can be complicated to debug, although, if you try to use a default/base configuration, the process might be simpler.

My suggestion is to try a container with the latest oh-my-zsh image, and copy your kubectl config file in the container, and do the basic configuration as outlined in the README.

jonmosco commented 1 year ago

Please reopen if this issue persists.