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

Bug: k8sgpt generate in docker container fails to open browser except linux #182

Closed
3 tasks done
VinayKadalagi opened this issue Apr 2, 2023 · 6 comments
Closed
3 tasks done
Milestone

Comments

@VinayKadalagi
Copy link

VinayKadalagi commented Apr 2, 2023

Checklist:

  • I've searched for similar issues and couldn't find anything matching
  • I've included steps to reproduce the bug.
  • I've included the version of Kubernetes and k8sgpt.

Steps to reproduce

Command:
docker run -v ~/.kube/config:/home/nonroot/.kube/config -v ~/.minikube:/Users/vinay/.minikube/ k8sgpt generate

Output:

Opening: https://beta.openai.com/account/api-keys to generate a key for openai
Please copy the generated key and run `k8sgpt auth` to add it to your config file

exec: "xdg-open": executable file not found in $PATH

Your environment

Darwin / MacOS

  • Version of Kubernetes
Client Version: v1.25.2
Kustomize Version: v4.5.7
Server Version: v1.25.3
  • Host OS and its version / If windows, is it WSL?
MacOS Ventura Version 13.2.1
  • Version of k8sgpt
    k8sgpt version dev

Expected behaviour

Default browser should open the given URL.

Actual behaviour

Errors out: xdg-open command not found since runtime.GOOS is always linux as it is running inside container.

@AlexsJones
Copy link
Member

Typically, I'd anticipate you mount the secret into the docker container rather than trying to generate it inside e.g.

version: '2'
services:
 k8sgpt:
   image: ghcr.io/k8sgpt-ai/k8sgpt:dev-202304011623
   volumes:
     -  /home/$(whoami)/.k8sgpt.yaml:/home/root/.k8sgpt.yaml

However you are right it's a bug, but perhaps we just hide the error message if xdg-open has not been found?

@matthisholleville
Copy link
Contributor

Shouldn't we add a small note in the documentation?

@AlexsJones
Copy link
Member

We could add this as a sub section on the docs site under installation

@VinayKadalagi
Copy link
Author

Thank you.
@AlexsJones @thschue do you guys have any task for me ? I am more than happy to contribute.
I can work on anything from devops related tasks as well as enhancements. Thank you

@AlexsJones
Copy link
Member

Thank you.

@AlexsJones @thschue do you guys have any task for me ? I am more than happy to contribute.

I can work on anything from devops related tasks as well as enhancements. Thank you

Thank you for raising this 🙂

@kedar1704
Copy link

kedar1704 commented Aug 24, 2023

@AlexsJones i am using this docker compose file
version: '2'
services:
k8sgpt:
image: ghcr.io/k8sgpt-ai/k8sgpt:dev-202308191912
volumes:
- /root/.kube/kube_config.yaml:/home/root/.k8sgpt.yaml
command: ["auth", "add", "--backend", "azureopenai", "--baseurl", "https://", "--engine", "<deployment_name>", "--model", "<model_name>", "-p","apikey"]

so with this the authentication is getting done. Can you please tell now how can I run the analyze command as well with this compose file

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

5 participants