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

Allow to specify the kubernetes context #175

Open
mool opened this issue Nov 3, 2024 · 5 comments
Open

Allow to specify the kubernetes context #175

mool opened this issue Nov 3, 2024 · 5 comments

Comments

@mool
Copy link

mool commented Nov 3, 2024

It would be nice to add support for the --context argument when holmes is executing the kubectl command. This will allow to run holmes without having to change context

@aantn
Copy link
Contributor

aantn commented Nov 3, 2024

We should be able to add something.

It connects well with work we're doing on tool configuration right now (specifically how do you configure tools that require parameters or credentials to work, like pulling data from Grafana cloud or Elasticsearch?)

Would you be open to a short video chat so I can better understand your requirements and verify the solution works?

@Hax7
Copy link

Hax7 commented Nov 7, 2024

For me this is a must feature. I use holmesgpt from k9s and if the context I'm using inside of k9s is different than the context in zsh(before starting k9s) then shift+h(ask holmesgpt) will not work and will say the namespace or resource does not exist but if holmes worked in the context of k9s then it will work as expected.

@aantn
Copy link
Contributor

aantn commented Nov 7, 2024

Hi @Hax7, thanks for chiming in.

I think we'll be able to support this properly soon. Until then, could something like this be a workaround?

kubernetes/kubernetes#27308 (comment)

@Hax7
Copy link

Hax7 commented Nov 7, 2024

I don't this "workaround" is related to this case, when 'holmes ask' command is executed from k9s it works on the current-context in the shell not the current context inside k9s. I use kubectx outside of k9s and it works fine so the alias you referred to is not gonna change anything here. I also tried this "holmes ask "why is $NAME of $RESOURCE_NAME in -n $NAMESPACE in --context CONTEXT_NAME not working as expected" but it ignores the --context here for some reason when holmes executs the kubectl command

@aantn
Copy link
Contributor

aantn commented Nov 8, 2024

Got it, thanks. To elaborate on why this doesn't work, HolmesGPT runs commands according to permitted templates. So to fix this you can patch the templates it uses for kubectl commands and reinstall holmes from source with those changes.

But we're looking into some proper fixes that make this easier to do + a k9s specific fix that we can get to you fast.

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

3 participants