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

provide a fabric8 goal to run a docker container as if its inside a kubernetes environment #3619

Open
jstrachan opened this issue Mar 18, 2015 · 5 comments

Comments

@jstrachan
Copy link
Contributor

its gonna be handy to run a local docker build as if it were part of a kubernetes cluster; but without having to push the image onto kubernetes and create a Replication Controller using it etc.

i.e. just run a single docker container as if its been created by a Replication Controller.

Mostly thats just

  • use the env vars from the kubernetes.json file
  • set the env vars from the services available in a namespace on a remote kubernetes environment
  • ensure that any service IPs are accessible (e.g. use routes if they are available - if not am not sure how else we can do that bit - for http we could use api/v1beta2/proxy/service/foo but for TCP stuff I'm not sure ;)

I guess DNS should fix the service IPs thing ultimately? Or maybe this only works for services with a route?

@jstrachan
Copy link
Contributor Author

this relates to https://github.com/rhuss/docker-maven-plugin/issues/119 as well - if we're a really fast way to spin up a docker container using a local build; we'd want to set the env vars properly so it can reuse the kubernetes configuration and services

@iocanel iocanel self-assigned this Mar 18, 2015
@jstrachan
Copy link
Contributor Author

I wonder, as this is mostly about setting env vars - if we could somehow have a tool to generate the env vars for a namespace to a temporary local file - that the docker plugin could reuse?

e.g. we generate target/docker/envVars.properties or something which the docker:run maven plugin reuses if its present (and enabled) to set the env vars when running things?

As mostly all those env vars should be static for a single namespace (once the services are all created)

@jstrachan
Copy link
Contributor Author

I just raised this issue on docker-maven-plugin to make it easier to pass in a file for the environment variables https://github.com/rhuss/docker-maven-plugin/issues/128 for times when we want to generate environment variables programatically - e.g. via using the REST API on a remote kubernetes environment

@jstrachan
Copy link
Contributor Author

Maybe we need to generate 2 files for the kubernetes services environment variables

  • properties file that the docker maven plugin (or maven properties plugin) can reuse
  • a shell script file containing export commands so that folks can source it on their shell...
export FOO_SERVICE_HOST=blah
export FOO_SERVICE_PORT=123
...

then folks could type:

source target/fabric8/env.sh

to then have their local environment variables defined as if they are running inside kubernetes; so that folks could use "mvn exec:java" and the like...

@iocanel
Copy link
Member

iocanel commented Mar 20, 2015

We don't need to use maven properties plugin. Since we create a mojo of our own, to create the properties file, that mojo can also set the properties to "project properties". Then the docker maven plugin can find them.

@iocanel iocanel removed their assignment Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants