0

I'm trying to deploy a simple WordPress example (WordPress & MySQL DB) on Microsofts new Azure Container Service with Mesos & Marathon as the underlying orchestration platform. I already ran this on the services offered by Google (Kubernetes) and Amazon (ECS) and thought it would be an easy task on ACS as well.

I have my Mesos cluster deployed and everything is up and running. Deploying the MySQL container isn't a problem either, but when I deploy my WordPress container I can't get a connection to my MySQL container. I think this might be because MySQL runs on a different Mesos agent?

What I tried so far:

  1. Using the Mesos DNS to get ahold of the MySQL container host (for now I don't really care which container I get ahold of). I set the WORDPRESS_DB_HOST environment var to mysql.marathon.mesos and specified the host of MySQL container as suggested here.

  2. I created a new rule for the Agent Load Balancer and a Probe for port 3306 in Azure itself, this worked but seems like a very complicated way to achieve something so simple. In Kubernetes and ECS links can be simply defined by using the container name as hostname.

An other question that came up, what difference is their in Marathon between setting the Port in the Port Mappings Section and in the Optional Settings section. (See screenshot attached)

Update: If I ssh into the master node than I can dig by using mysql.marathon.mesos, how ever I can't get a connection to work from within an other container (in my case the wordpress container).

Port Mapping in Marathon

Kevin Goedecke
  • 1,553
  • 2
  • 14
  • 26

1 Answers1

0

So there are essentially two questions here: one around stateful services on Marathon, the other around port management. Let me first clarify that neither has to do anything with Azure or ACS in the first place, they are both Marathon-related.

Q1: Stateful services

Depending on your requirements (development/testing or prod) you can either use Marathon's persistent volumes feature (simple but no automatic failover/HA for the data) or, since you are on Azure, a robust solution like I showed here (essentially mounting a file share).

Q2: Ports

The port mapping you see in the Marathon UI screen shot is only relevant if you launch a Docker image and want to explicitly map container ports to host ports in BRIDGE mode, see the docs for details.

Michael Hausenblas
  • 13,162
  • 4
  • 52
  • 66
  • Considering my WordPress example, how would that actually work in my case, I dont see how i can take advantage of persistent volumes in this scenario? About the Ports: Yes that how I expected it to work, however I cant seem to reach my MySQL host from within my WordPress container even though I enabled Port Mapping, what would i even use as the hostname? – Kevin Goedecke Apr 06 '16 at 00:39
  • One way would be to pin both containers (WP and MySQL) on to the same node using Constraints (see https://mesosphere.github.io/marathon/docs/constraints.html for details) and then have a persistent volume. This, together with persistent volumes protects against container failures, but for node failures you'd need the file share mount variant. – Michael Hausenblas Apr 06 '16 at 00:43
  • BTW, since there are multiple questions and this turns into a discussion: can you pls join http://chat.mesosphere.com/ and have this discussion on Slack and once we're done I update it here? – Michael Hausenblas Apr 06 '16 at 00:44