Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

[Q&A] Kubernetes as backend? #2

Closed
ghost opened this issue Mar 11, 2018 · 2 comments
Closed

[Q&A] Kubernetes as backend? #2

ghost opened this issue Mar 11, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 11, 2018

What would it take to take (parts) of Batect to use kubernetes as runtime?

That could be useful if people wanted to escape their constrained workstation resources and run in the cloud.

Something relevant or inspiring might be argo.

@charleskorn
Copy link
Collaborator

Hey @Byron-TW, thanks for the question.

(@Byron-TW contacted me offline about this, I'm sharing my original response from that conversation below.)

In theory, it shouldn’t be too hard to plug another runner into batect so that things are launched on Kubernetes instead of directly on Docker.

Practically, it’s a bit different :) These are some of the issues I foresee:

  • there isn’t a clean separation in the code between the process of orchestrating containers and the thing that they’re running on (eg. Docker) - everything is fairly tied to the Docker way of thinking about and doing things
  • mounting a local directory would be a little tricky - you’d have to package up the files or folder in question and deploy them alongside the image, and there would be work in bringing back any new files to the local workspace (eg. if the build process inside the pod creates some build artifacts like a JAR file, you’d either have to archive that JAR as part of the build process or somehow pull the newly created files back into the local filesystem)
  • …and if you wanted to support syncing changes to the local filesystem to the pod in realtime (to enable scenarios like continuous unit testing), that would be another order of magnitude harder again
  • ditto for port mappings - if you want to run your app remotely and then interact with it locally, there would be some work in making that work seamlessly

If you’re just thinking of using Kubernetes in CI scenarios (but local Docker for local development scenarios), it should be feasible, since those last two points aren’t so relevant in that situation. Docker-in-pods might help you avoid having to change batect, but mounting directories from Docker-in-pods gets tricky quickly.

I hadn’t seen Argo before, thanks for passing that along. Looks really interesting, and not just for build scenarios but also more complex batch processing-style tasks.

@charleskorn
Copy link
Collaborator

While this is something I'd be interested in exploring in the future, I have no immediate plans to act on this, so I'm going to close this issue.

If anyone has any thoughts on this topic, please feel free to continue the discussion here.

charleskorn added a commit that referenced this issue Dec 23, 2020
…ith an image that uses a non-default syntax.

The output previously looked something like (note output for #3 and #4):

#1 [internal] load remote build context
#1 DONE

#2 copy /context /
#2 DONE

#3 resolve image config for docker.io/docker/dockerfile:1.1-experimental
#3 ...

#4 docker-image://docker.io/docker/dockerfile:1.1-experimental@sha256:de85b2f3a3e8a2f7fe48e8e84a65f6fdd5cd5183afa6412fff9caa6871649c44
#4 ...

#5 [internal] load metadata for docker.io/library/ruby:2.7.2
#5 DONE

#6 [ 1/12] FROM docker.io/library/ruby:2.7.2
#6 DONE

#7 [ 2/12] RUN mkdir -p /tools
#7 CACHED

#8 [ 3/12] COPY health-check.sh /tools
#8 CACHED

#9 [ 4/12] RUN mkdir -p /app
#9 CACHED

#10 [ 5/12] COPY app/Gemfile app/Gemfile.lock /app/
#10 CACHED

#11 [ 6/12] WORKDIR /app
#11 CACHED

#12 [ 7/12] RUN bundle config set deployment true
#12 CACHED

#13 [ 8/12] RUN bundle config set without development
#13 CACHED

#14 [ 9/12] RUN bundle install
#14 CACHED

#15 [10/12] COPY app/config.ru /app
#15 CACHED

#16 [11/12] COPY app/bin /app/bin
#16 CACHED

#17 [12/12] COPY app/lib /app/lib
#17 ...

#3 resolve image config for docker.io/docker/dockerfile:1.1-experimental
#3 DONE

#4 docker-image://docker.io/docker/dockerfile:1.1-experimental@sha256:de85b2f3a3e8a2f7fe48e8e84a65f6fdd5cd5183afa6412fff9caa6871649c44
#4 CACHED

#17 [12/12] COPY app/lib /app/lib
#17 CACHED

#18 exporting to image
#18 exporting layers: done
#18 writing image sha256:ace2572ab366a9153b23ccc0667cc6163a32a3cbb96bfef237a25c68005699a6: done
#18 naming to docker.io/library/batect-sample-ruby-international-transfers-service: done
#18 DONE
charleskorn pushed a commit that referenced this issue Jan 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant