fabric8io / fabric8

fabric8 is an open source microservices platform based on Docker, Kubernetes and Jenkins
http://fabric8.io/
1.76k stars 504 forks source link

make it easy to run local builds of Java services as local docker builds (or Java mains) and have them register into kubernetes as Services #3624

Open jstrachan opened 9 years ago

jstrachan commented 9 years ago

Imagine you're working on a service which has a number of containers invoking it. You don't want to have to run everything locally on your box; you just want to run this one service you're working on locally; while running everything else inside kubernetes.

So you want to reuse a kubernetes environment (namespace) running various pieces; but just work on 1 container locally using your local code before you commit.

So you wanna run a process locally (inside docker or outside) as if its part of kubernetes (like this issue https://github.com/fabric8io/fabric8/issues/3619) but you also want to register your service as a Service into kubernetes so that it can be discovered by other containers which are really running inside kubernetes.

e.g. imagine we want to experiment with or debug a local build of Fabric8MQ; but reuse the existing apps for the MQ producer & consumer inside kubernetes.

So we'd want to be able to:

Its then really easy to work on the code iteratively; debug your local build of the service - while reusing all the kubernetes infrastructure, apps, discovery etc.

i.e. its like you're laptop is part of kubernetes.

In many ways this is very much like the motivation behind https://github.com/fabric8io/fabric8/issues/3619 - but its focussing on working on a service implementation so that you can reuse other kubernetes resources to invoke / consume the service you're developing

jstrachan commented 9 years ago

Incidentally while developing various back end services (e.g. App Library, Fabric8 Forge, Api Library) I found myself doing something like the above; but as a horrid hack - I hacked the fabric8 console to redirect some services in the /api/v1beta2/proxy/services/$foo/* namespace to point at a locally running service.

This hack was invaluable in trying out services (which are not yet packaged/released as a docker image + app) from inside the fabric8 console. Though its a bit of a dirty hack really ;) What'd be much cleaner is if we had a way to run any Java process as if its really a Service implementation inside Kubernetes.

e.g. then I could reuse an entire hosted OpenShift namespace (its console & all its services) and just point one service implementation at my laptop's Java process its running.

Certainly for folks working on the console - this would be really really handy ;)

The hardest bit is figuring out the ssh tunnel / DNS / IP thing so that the kubernetes cluster can see my laptop's IP address.

@jimmidyson this sounds like a DNS problem - everything's a DNS problem right? :)

jstrachan commented 9 years ago

Maybe something like this could help being able to expose a local port to the internet so that it can be used from inside the Service definition inside kubernetes? https://ngrok.com/docs