There are several ways to accomplish external routing. 1. Expose your pod network directly to the rest of your infrastructure (make 10.0.X.X routable from other places) 2. Use a service that is of type NodePort and connect to the node(s) on the port you receive directly (if you need HA, you'll want to use the ipfailover plugin on a set of nodes like the router). 3. Identify a block of IPs in your network you want to use for services and route that to the machines defined in 2, then on your MySQL services set an externalIP out of that block. That will route to the service via the nodes and then on to the pods.
On Mar 3, 2016, at 9:04 AM, Ben Parees <[email protected]> wrote: On Thu, Mar 3, 2016 at 3:21 AM, David Balakirev <[email protected]> wrote: > Hi, > > Thanks for the answers Ben, Aaron! > > Right so at this point the applications themselves are not hosted inside > OpenShift. There is a plan for that but we are not there yet. > > @Aaron your assumption was right in a sense that I intend to have MySQL > available as a service to applications running on our corporate build > infra. > They would connect and run their database creation scripts and test. > > So while I have confidence I could access the service from other apps > hosted inside the OpenShift infra, I actually need to somehow access them > extenally. > > To re-iterate the question, I am puzzled how should I route connections to > the TCP port of the MySQL service (or pod?) from the network. > external access requires a Route and routes only support http/https/websocket or SNI traffic. Your generic TCP requirements can only be met if you use a TLS connection and your mysql clients support SNI (that is how openshift can know where to route the request). https://docs.openshift.org/latest/dev_guide/routes.html > I assume it has something to do with routing / port forwarding. > > @Ben thanks I'll checkout what those templates offer. > > > On 03/02/2016 05:45 PM, Ben Parees wrote: > > > > On Wed, Mar 2, 2016 at 11:41 AM, Aaron Weitekamp < <[email protected]> > [email protected]> wrote: > >> On Wed, Mar 2, 2016 at 9:05 AM, Ben Parees < <[email protected]> >> [email protected]> wrote: >> >>> Take a look at this template which deploys mysql: >>> >>> https://github.com/openshift/origin/blob/master/examples/db-templates/mysql-ephemeral-template.json >>> (or this one which uses persistent storage: >>> <https://github.com/openshift/origin/blob/master/examples/db-templates/mysql-persistent-template.json> >>> https://github.com/openshift/origin/blob/master/examples/db-templates/mysql-persistent-template.json >>> ) >>> >>> And this application which deploys both a DB and an application that >>> communicates with that DB: >>> >>> https://github.com/openshift/origin/blob/master/examples/quickstarts/cakephp-mysql.json >>> (source for the application is here: >>> <https://github.com/openshift/cakephp-ex> >>> https://github.com/openshift/cakephp-ex) >>> >>> I would not necessarily expect you to deploy a single mysql instance and >>> have each app create its own DB in that instance. I'd expect each app to >>> just deploy its own mysql instance for testing. I think you will find that >>> easier to setup. >>> >>> >> While one db per app is straightforward and there >> are many examples of this, aren't there benefits to hosting a single DB >> service that apps can use? This is the enterprise model. It seems to me >> the question is how to share a service across projects. Once that's in >> place it should "just work" but I couldn't figure out how that might be >> done. oc policy ... ? >> >> >> > > by default, a service is accessible to all other projects, no policy > needed. the challenge you have is creating the additional DBs in the mysql > instance. Our image creates one DB for you, if you want to create more, > its up to you to exec into the DB container and run mysql commands to > create more databases. > > > > >> >>> >>> On Wed, Mar 2, 2016 at 4:13 AM, David Balakirev < >>> <[email protected]>[email protected]> wrote: >>> >>>> Hi, >>>> >>>> I am trying to host MySQL containers inside OpenShift. The goal would >>>> be that projects could connect to a given container, setup a database for >>>> themselves remotely and execute their integration tests. >>>> >>>> The first question could be: is this something OpenShift could be used >>>> for or not? >>>> >>>> For my installation I created a project with a single MySQL app >>>> (mysql:latest). >>>> >>>> On the server, I can connect to the database via TCP (--protocol=tcp): >>>> * via the IP of the pod >>>> * via the IP of the service (that was auto created for me) >>>> >>>> Of course the goal would be to access the database from our corporate >>>> network. >>>> >>>> After digesting many threads on Stackoverflow, especially [1] and [2] I >>>> think the conclusion is that only port 80/443/8000/8443 could be >>>> accessed externally. >>>> >>>> I know of services, routes and port-forwarding, but probably I did not >>>> yet understand when they should be used. >>>> >>>> I can use port-forwarding to map 3306 to a local port, then I access >>>> the database via "-h localhost". >>>> >>>> I0302 09:20:01.133388 9195 portforward.go:213] Forwarding from >>>> 127.0.0.1:49220 -> 3306 >>>> I0302 09:20:01.133516 9195 portforward.go:213] Forwarding from >>>> [::1]:49220 -> 3306 >>>> >>>> But I assume I cannot use this to expose the port because of what I >>>> have found in [1] and [2]. >>>> >>>> Routes I learned could be used to match a path, but I think that is >>>> better used for HTTP services. >>>> >>>> Frankly I did not yet understand the role of a Router in this context. >>>> >>>> Could someone please let me know if it is possible to do what I want or >>>> not? RTFM is perfect for me, provided I can see a specific example for >>>> exposing a TCP port somehow. It is possible the solution is there but I did >>>> not realize. >>>> >>>> I am using Origin: 1.1.3. >>>> >>>> Thanks in advance, >>>> Dave >>>> >>>> [1] <http://stackoverflow.com/>http://stackoverflow.com/ >>>> questions/33985138/how-to-host-and-access-murmur-mumble-server-on-openshift-without-port-forwardi?rq=1 >>>> [2] <http://stackoverflow.com/>http://stackoverflow.com/ >>>> questions/33838765/openshift-v3-confusion-on-services-and-routes >>>> >>>> _______________________________________________ >>>> dev mailing list >>>> [email protected] >>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/dev >>>> >>>> >>> >>> >>> -- >>> Ben Parees | OpenShift >>> >>> >>> _______________________________________________ >>> dev mailing list >>> [email protected] >>> http://lists.openshift.redhat.com/openshiftmm/listinfo/dev >>> >>> >> > > > -- > Ben Parees | OpenShift > > > -- Ben Parees | OpenShift _______________________________________________ dev mailing list [email protected] http://lists.openshift.redhat.com/openshiftmm/listinfo/dev
_______________________________________________ dev mailing list [email protected] http://lists.openshift.redhat.com/openshiftmm/listinfo/dev
