krane icon indicating copy to clipboard operation
krane copied to clipboard

Dockerize krane

Open zedtux opened this issue 4 years ago • 8 comments

In order to make it even more easy to use (not wasting time and system with Ruby and gems to be installed), it would be great to have this tool in a Docker container.

zedtux avatar Mar 10 '21 10:03 zedtux

I'm open to this assuming we've got the infrastructure to make this happen easily. By and chance do you have an example Dockerfile we could build?

dturn avatar Mar 18 '21 17:03 dturn

I'm open to this assuming we've got the infrastructure to make this happen easily.

Maybe you're thinking of the pipeline? If that's the case, as you're using Github, GH Actions would do it otherwise there are plainly of free options out there.

By and chance do you have an example Dockerfile we could build?

Not yet but it shouldn't be that hard since krane is just a gem. I will give it a try and let you know.

zedtux avatar Mar 18 '21 18:03 zedtux

If you're talking about being able to execute krane via docker run... (and not the pipeline-build) maybe this will help - https://github.com/strowi/deploy/.

We're using this as general "deploy"container for docker-compose + kubernetes, it definitely could be slimmed down if only krane is wanted. But it might help to get you started.;) The main problem might be getting all the variables/config-files into the container...

strowi avatar Apr 05 '21 10:04 strowi

After thinking about this more, I'm hesitant to actually build a container. kubectl is only supporting one version a head a one behind (https://kubernetes.io/docs/setup/release/version-skew-policy/#kubectl) which makes me think we'll never include a version that makes enough people happy.

I'm still happy to add an example Dockerfile to the documentation though.

dturn avatar Apr 06 '21 21:04 dturn

Sorry @dturn I don't understand what's the issue here.

zedtux avatar Apr 07 '21 02:04 zedtux

@dturn is right. The kubectl-version is (more or less) bound to the cluster-version. So having kubectl-v1.18 in the docker-image you could only support clusters with v1.18+v1.19. Same goes the other way around for deprecations. With the linked deploy-image we are only supporting a handful of clusters we have control over, so this is not a problem. But "in the open" you will get a lot of trouble.

Workaround could be mounting kubectl from the host, or downloading it in an init-script (this can/will get you probably rate-limited at least).

strowi avatar Apr 07 '21 06:04 strowi

Another option would be building plain old krane binaries using something like https://github.com/pmq20/ruby-packer or https://github.com/phusion/traveling-ruby . If it needs to collaborate with other elements from the system like kubectl and the kube config, seems like the best fit would be to make it a program! It is definitely annoying to have to install a whole system ruby just to run krane if you aren't using ruby for anything else.

airhorns avatar Jun 05 '21 17:06 airhorns

I agree with @airhorns, krane should be available as a binary.

dudicoco avatar Jul 15 '22 09:07 dudicoco