Skip to content
New issue

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

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

Already on GitHub? # to your account

How to run Robusta KRR in docker? #375

Open
bab5470 opened this issue Dec 10, 2024 · 4 comments
Open

How to run Robusta KRR in docker? #375

bab5470 opened this issue Dec 10, 2024 · 4 comments

Comments

@bab5470
Copy link

bab5470 commented Dec 10, 2024

If there is documentation for this I'm not finding it (kindly point me in the right direction if I've overlooked something).

I've cloned the KRR repo and run:
docker build -t krr .
docker run -d --name krr -v /home/myuser/.kube/krr.yml:/root/.kube/config -e KRR_KUBE_CONFIG=/root/.kube/config -e KRR_KRR_PORT=8080 localhost/krr:latest

I am getting:


 _____       _               _          _  _______  _____
|  __ \     | |             | |        | |/ /  __ \|  __ \
| |__) |___ | |__  _   _ ___| |_ __ _  | ' /| |__) | |__) |
|  _  // _ \| '_ \| | | / __| __/ _` | |  < |  _  /|  _  /
| | \ \ (_) | |_) | |_| \__ \ || (_| | | . \| | \ \| | \ \
|_|  \_\___/|_.__/ \__,_|___/\__\__,_| |_|\_\_|  \_\_|  \_\


Thanks for using Robusta KRR. If you have any questions or feedback, please feel
free to reach out to us at
https://github.com/robusta-dev/krr/issues

Watch our latest video to optimize your workloads and save costs:
https://www.youtube.com/watch?v=TYRA2QcDIuI



Running Robusta's KRR (Kubernetes Resource Recommender) dev
Using strategy: Simple
Using formatter: table

[16:39:16] ERROR    Could not load kubernetes configuration:       runner.py:326
                    Service host/port is not set.
           ERROR    Try to explicitly set --context and/or         runner.py:327
                    --kubeconfig flags.

How do I specify the service host/port and the kubeconfig files? Is there an example somewhere?

@nathanmcgarvey-modopayments
Copy link

nathanmcgarvey-modopayments commented Dec 10, 2024

I use this with an EKS cluster and SSO configured, successfully (though my mounts are a bit broad):

docker run --rm --volume "${KUBECONFIG}:/root/.kube/config:ro" --volume "${HOME}/.aws:/root/.aws:ro" -e KUBECONFIG=/root/.kube/config localhost/krr

However, I build a custom image to include the awscli in the image:

FROM us-central1-docker.pkg.dev/genuine-flight-317411/devel/krr:v1.18.0
RUN apt-get update && \
    apt-get -y install awscli

@nathanmcgarvey-modopayments
Copy link

nathanmcgarvey-modopayments commented Dec 10, 2024

Oh, and if you want options, you have to specify the full command as the base image has no entrypoint:

docker run --rm -t --volume "${KUBECONFIG}:/root/.kube/config:ro" --volume "${HOME}/.aws:/root/.aws:ro" -e KUBECONFIG=/root/.kube/config -e "TERM=xterm-256color" localhost/krr python krr.py simple --allow-hpa --width 300

Note that I also ensured it has colorized output and a much wider than default width for docker terminal stuff.

@bab5470
Copy link
Author

bab5470 commented Dec 11, 2024

None of these are working for me:

docker run --rm --volume "${KUBECONFIG}:/root/.kube/config:ro" -e KUBECONFIG=/root/.kube/config localhost/krr

 _____       _               _          _  _______  _____
|  __ \     | |             | |        | |/ /  __ \|  __ \
| |__) |___ | |__  _   _ ___| |_ __ _  | ' /| |__) | |__) |
|  _  // _ \| '_ \| | | / __| __/ _` | |  < |  _  /|  _  /
| | \ \ (_) | |_) | |_| \__ \ || (_| | | . \| | \ \| | \ \
|_|  \_\___/|_.__/ \__,_|___/\__\__,_| |_|\_\_|  \_\_|  \_\


Thanks for using Robusta KRR. If you have any questions or feedback, please feel
free to reach out to us at
https://github.com/robusta-dev/krr/issues

Watch our latest video to optimize your workloads and save costs:
https://www.youtube.com/watch?v=TYRA2QcDIuI



Running Robusta's KRR (Kubernetes Resource Recommender) dev
Using strategy: Simple
Using formatter: table

[01:12:14] ERROR    Could not load kubernetes configuration:       runner.py:326
                    [Errno 13] Permission denied:
                    '/root/.kube/config'
           ERROR    Try to explicitly set --context and/or         runner.py:327
                    --kubeconfig flags.

docker run --rm --volume "${KUBECONFIG}:/root/.kube/config:ro" -e KUBECONFIG=/root/.kube/config localhost/krr python krr.py simple --allow-hpa

 _____       _               _          _  _______  _____
|  __ \     | |             | |        | |/ /  __ \|  __ \
| |__) |___ | |__  _   _ ___| |_ __ _  | ' /| |__) | |__) |
|  _  // _ \| '_ \| | | / __| __/ _` | |  < |  _  /|  _  /
| | \ \ (_) | |_) | |_| \__ \ || (_| | | . \| | \ \| | \ \
|_|  \_\___/|_.__/ \__,_|___/\__\__,_| |_|\_\_|  \_\_|  \_\


Thanks for using Robusta KRR. If you have any questions or feedback, please feel
free to reach out to us at
https://github.com/robusta-dev/krr/issues

Watch our latest video to optimize your workloads and save costs:
https://www.youtube.com/watch?v=TYRA2QcDIuI



Running Robusta's KRR (Kubernetes Resource Recommender) dev
Using strategy: Simple
Using formatter: table

[01:12:44] ERROR    Could not load kubernetes configuration:       runner.py:326
                    [Errno 13] Permission denied:
                    '/root/.kube/config'
           ERROR    Try to explicitly set --context and/or         runner.py:327
                    --kubeconfig flags.

docker run --rm --volume "${KUBECONFIG}:/root/.kube/config:rw" -e KUBECONFIG=/root/.kube/config localhost/krr python krr.py simple --allow-hpa

 _____       _               _          _  _______  _____
|  __ \     | |             | |        | |/ /  __ \|  __ \
| |__) |___ | |__  _   _ ___| |_ __ _  | ' /| |__) | |__) |
|  _  // _ \| '_ \| | | / __| __/ _` | |  < |  _  /|  _  /
| | \ \ (_) | |_) | |_| \__ \ || (_| | | . \| | \ \| | \ \
|_|  \_\___/|_.__/ \__,_|___/\__\__,_| |_|\_\_|  \_\_|  \_\


Thanks for using Robusta KRR. If you have any questions or feedback, please feel
free to reach out to us at
https://github.com/robusta-dev/krr/issues

Watch our latest video to optimize your workloads and save costs:
https://www.youtube.com/watch?v=TYRA2QcDIuI



Running Robusta's KRR (Kubernetes Resource Recommender) dev
Using strategy: Simple
Using formatter: table

[01:13:28] ERROR    Could not load kubernetes configuration:       runner.py:326
                    [Errno 13] Permission denied:
                    '/root/.kube/config'
           ERROR    Try to explicitly set --context and/or         runner.py:327
                    --kubeconfig flags.

@aantn
Copy link
Contributor

aantn commented Dec 16, 2024

Hi, we'd be happy to jump on a call and help you figure it out? Can you get in touch on our Slack community please? https://home.robusta.dev/slack

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

No branches or pull requests

3 participants