robscott / kube-capacity

A simple CLI that provides an overview of the resource requests, limits, and utilization in a Kubernetes cluster
Apache License 2.0
2.09k stars 114 forks source link

Add dockerfile #58

Closed day1118 closed 1 year ago

day1118 commented 2 years ago

This PR adds a dockerfile which builds kube-capacity to make it more portable. It would be great to add an automated build step and push it to a docker registry.

robscott commented 2 years ago

Hey @day1118, thanks for the PR! Is there any particular use case you had in mind for this? I've generally intended for kube-capacity to be a standalone cli tool. I'm not sure how helpful a Docker image would be for this.

day1118 commented 2 years ago

Is there any particular use case you had in mind for this?

TLDR: It means that the kube-capacity can be run from any machine without having to install anything other than docker, making it very portable.

Hi @robscott I have shifted to using almost all cli tools from within docker. Some examples include gcloud, helm, kubectl, jq, kube-linter, kubescore etc. If you create a simple docker compose file for any of those clis, you only need to prepend docker-compose run to a command and it will run within a container. (eg docker-compose run kube-capacity --pods --util) I find this great as my team do no need to install any tools, and you can change version back and forth very easily.

I'd love this option for kube-capacity also, and hope that you will consider automating the container build and pushing it to Dockerhub too! I'd be happy to help you set this up if you'd like.

day1118 commented 2 years ago

Hi @robscott Any thoughts on merging this? Thanks

robscott commented 2 years ago

Hey @day1118, thanks for the reminder! Unfortunately I don't have the time to set up (and more importantly maintain) a Docker registry for this image. I am open to including a Dockerfile in the repo though. To minimize maintenance and potential vulnerabilities, I'd prefer an image with a distroless base though.

day1118 commented 2 years ago

That makes sense - I do find that distroless can be quite frustrating to troubleshoot etc as you don't have a shell, but it is your project after all.

robscott commented 2 years ago

Yeah I completely get that, I've just been on the hook for keeping images patched that we're not distroless and it was quite a task to keep up with. Unfortunately I just don't think I'd have enough time to keep up with that on this project.

robscott commented 1 year ago

Going to close this out since I just haven't had much time to spend on this project. Thanks for the idea though!