tilt-extensions icon indicating copy to clipboard operation
tilt-extensions copied to clipboard

kubefwd in docker

Open 4nte opened this issue 4 years ago • 4 comments

I think it would be helpful if kubefwd would run in a docker container. This would make tilt environment more portable, as it wouldn't require users to manually install kubefwd on their machine. Also, it would enable kubefwd version pinning per project (not saying it's necessary, but it's always good to know that everyone is using the same version)

4nte avatar Oct 08 '21 19:10 4nte

ooh interesting suggestion.

were you imagining that all of your services run in a single docker container where kubefwd is managing /etc/hosts?

or are you imagining that each service is running in its own docker container with a kubefwd alongside it?

nicks avatar Oct 27 '21 16:10 nicks

Services are containers in the cluster, as per usual. But Instead of running kubefwd from a local binary (which has to be pre-installed by the user), we could run kubefwd as a docker container - which will manage the /etc/hosts file on the host's machine (as per usual)

Here, kubefwd is expected to be in the $PATH on the user's machine https://github.com/tilt-dev/tilt-extensions/blob/cf928ff3302758bfeb771c302833de6ff77dc5ac/kubefwd/sudo-kubefwd.sh#L12

This is where kubefwd is actually being executed https://github.com/tilt-dev/tilt-extensions/blob/cf928ff3302758bfeb771c302833de6ff77dc5ac/kubefwd/run-kubefwd-internal.sh#L22

I simply propose that we don't rely on the user to have kubefwd installed, but rather expect that user has Docker installed (which will always be true, since it's a prerequisite to tilt.dev) and run the kubefwd program as a docker container.

4nte avatar Oct 28 '21 11:10 4nte

hmmm...I'm not sure it's that simple. I think we'd also need to:

  • mount /etc/hosts in the kubefwd container (so that any changes to /etc/hosts are propagated to the host network stack)
  • mount any kubectl secrets you need in the kubefwd container (so that kubefwd can access your cluster)

does that sound right? or is there something i'm missing?

also as an aside - a local docker is not necessarily a prerequisite to tilt.dev - lots of teams use a remote docker or a custom builder (like kubectl_build) on a remote cluster.

nicks avatar Oct 29 '21 00:10 nicks

  • mount /etc/hosts in the kubefwd container (so that any changes to /etc/hosts are propagated to the host network stack)
  • mount any kubectl secrets you need in the kubefwd container (so that kubefwd can access your cluster)

I think that's about right.

also as an aside - a local docker is not necessarily a prerequisite to tilt.dev

I see, although it's not a prerequisite, I think most users will have Docker installed. In the worst case, an user will have to install Docker, as opossed to installing kubefwd standalone binary on their machine.

4nte avatar Nov 02 '21 12:11 4nte