Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectx and fzf on windows problem #307

Open
sergeypugachov opened this issue Jul 19, 2021 · 11 comments
Open

kubectx and fzf on windows problem #307

sergeypugachov opened this issue Jul 19, 2021 · 11 comments

Comments

@sergeypugachov
Copy link

I use latest kubectx (0.9.4) and fzf (0.27.2) with powershell 7 on windows 10 (19042.1110).

If i remove fzf from PATH, everything works. With fzf on PATH, kubectx failed with error:

[Command failed: C:\Portable Programs\kubectx.exe]

image

@ahmetb
Copy link
Owner

ahmetb commented Jul 19, 2021

Can you set environment variable DEBUG=1 and see if it prints anything useful? Also does fzf work by itself?

@Tazminia
Copy link

@ahmetb I had the same issue on MacOS. The issue was resolved once I had more than one context in the list.

@v5tech
Copy link

v5tech commented Jan 11, 2022

@ahmetb I had the same issue on windows 11.

@davideLarosa
Copy link

here the same issue with kubectx and kubens. I'm running them on windows 11 using git bash. Does anyone solved it in some way? Thank you!

@davideLarosa
Copy link

Hi everyone, after a lot of tests i've got my solution.
At the beginning I was placing all my gitbash customizations on a folder under C:\Program Files\shell_addons. In my PATH environment there was just a line adding this folder and, using kubens and kubectx with fzf the command was failing with the same message @sergeypugachov is having.
Now i moved the "shell_addons" folder under C:\ and it works.
Here my .bashrc settings:

...
#completion
source /etc/bash_completion.d/kubectl
source /c/shell_addons/kubectx/completion/kubens.bash
source /c/shell_addons/kubectx/completion/kubectx.bash
source /c/shell_addons/fzf/functions.sh
source /c/shell_addons/complete-alias/complete_alias
source /c/shell_addons/kube-ps1.sh

#alias complete
complete -F __start_kubectl k
complete -F _kube_contexts kx
complete -F _kube_namespaces ks

#fzf configuration
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
export FZF_DEFAULT_COMMAND="fd --type f"
export FZF_CTRL_T_OPTS="--preview 'bat --style=numbers --color=always --line-range :500 {}'"
export FZF_ALT_C_OPTS="--preview 'tree -C {}'"
...

Hope this can help.

Cheers.

@twobiers
Copy link

twobiers commented Jun 1, 2022

I had this issue too, in my case my SHELL environment variable was pwsh -NoLogo which seems to not work properly with fzf. Changing it to just pwsh without parameter fixed my problem. I tried to do some escaping on the parameter but couldn't make it work otherwise than completely removing it.

@upstream-dmahlberg
Copy link

I ran into a simliar problem on windows machines and found this blog post: https://medium.com/dataseries/handy-kubernetes-context-namespace-switcher-for-powershell-a432ff8ae7cd

This does not use kubectx / kubens per se, but offers a similar user experience utilizing two short powershell scripts. Hope this helps anyone out there!

@victorsmoliveira
Copy link

victorsmoliveira commented Feb 15, 2023

I only have this problem when using Git Bash terminal, powershell works fine. However I really wanted to use it with Git Bash. Does anyone have a fix?

@upstream-dmahlberg
Copy link

@vsmoliveira How did you get it to work with powershell? Which version fzf or which installer do you use?

@victorsmoliveira
Copy link

@upstream-dmahlberg Installed via chocolatey running choco install fzf.

The installed fzf version is 0.37.0 (2023012)
kubectx/kubens version is 0.9.4

@mloskot
Copy link

mloskot commented Apr 6, 2023

This seems related to #382

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants