- 26th April 2016
- Posted by: Stephen Downie
- Category: Containers, DC/OS, DevOps, JuJu, Mesos
WHAT IS DC/OS?
Container operating systems are all the rage at the moment, CoreOS, RancherOS, Ubuntu Snappy (sort of), Mesosphere DC/OS and others. “What are they?” I hear you ask. Container tech is coming of age currently and projects like Docker allow you to bundle applications up in Containers and deploy them as self contained virtual machines on your laptop, server, or data center. The cool thing about this is they all operate identically because under the hood they are running their own Operating System, they are abstracted away from the underlying OS and so if, for example, you have 2 webapps running on port 80, they don’t clash because they are running on different VM’s. They also make it easy to share applications in a preconfigured manner, or build a container on my laptop and deploy it to my data center knowing how it will act.
DC/OS is the Data Center Operating System, built by the cool guys at Mesosphere. If you follow container technology you’ll have heard of the name Mesos before, mostly because it belongs to the Apache Mesos project which allows you to “Program against your datacenter like s a single pool of resources”. Recently they released an open source version of their DC/OS platform which builds upon Apache Mesos and allows users to leverage that technology in a preconfigured manner to host their applications in their data center as if it were a single entity.
Take this for example, traditionally, if I spin up a container on my server and it’s load grows, at some point I would have to migrate that container to a more powerful server. Or as another example, I host my application on my server and my server dies, generally that’s bad news! What Mesos and DC/OS allow you to do, at a very simplistic level, is to build an elastic, fault tolerant service that your containers can run in. So I have a cluster of master nodes that manage my services and another cluster of agent nodes that execute the containers, DC/OS manages all that infrastructure in a highly flexible manner, so when I want to add new nodes I just connect them to the master and they are registered and available for use. Similarly if I want to scale down, I just switch them off. Simple! Of course it also copes with node failure so my containers don’t sink without trace if my server does.
DC/OS adds more to all of this with a great looking management interface, load balancing and service discovery, scheduling and storage management.
WHY MANAGE IT WITH JUJU?
On the DCOS.io website they have links to get you started, you can spin up a test setup on AWS, Centos, Azure, CoreOS, Packet or Vagrant. Great! But I want more. I want more flexibility and configurability. I also want to combine it with my existing infrastructure management tooling, which just so happens to be Juju.
Managing DC/OS with Juju brings it’s own benefits as well. I can run it easily on a bunch of different cloud services, for example, I could in under 10 minutes spin up DC/OS on AWS, HP Cloud, Open Stack or Bare Metal, although it doesn’t work currently, I’m pretty sure in the not too distant future I’d also be able to spin up a pseudo cluster on my Laptop using LXD local provider to mimic a multi node setup. Of course I can also use Juju to manage my firewall, instance sizes and storage with minimal effort. For example if I had a 3 node DC/OS master cluster and wanted to add 3 new agents, that would be as easy as
juju add-unit dcos-agent -n 3
Similarly if I wanted to add 3 new agents but make the extra large I could run:
juju deploy dcos-agent –constraints=”mem=16G cpu-cores=2″
juju add-relation dcos-agent dcos-master
and my cloud provider will find the best nodes to fit my constraint requirements and hook up the agents to my master node whilst I put my feet up and drink a coffee.
SHOW ME THE GOODS!
Okay, screenshots are always good, so here are a few captures of what we’re working on here at Spicule:
First up lets have a quick look at the main dashboard. It’s a great way of seeing whats going on in your cluster and instantly tells you what you need to know about the CPU usage, Memory consumption failures, containers deployed etc.
Finally, to prove that I’m not faking all of this, a quick screenshot of the Juju status output which shows my master down the bottom and its 11 agents.
For those of you who want to get involved, the charms aren’t yet in the charm store, mostly because they need more work to iron out the kinks and add more features, and also because we’re working with Canonical to get the code repositories and collaboration sorted out.
But in the mean time you can find the 3 repos you need here:
For those of you who like building charms once your environment variables are setup its no more than
charm build –series wily
for the dcos-master-charm and dcos-agent-charm
To deploy it you just do
juju deploy –repository=/home/bugg/charms local:wily/dcos-master
juju deploy –repository=/home/bugg/charms local:wily/dcos-agent
juju add-relation dcos-master dcos-agent
and thats about it, you’ll end up with a master node and an agent node. You can scale that up by running
juju add-unit dcos-agent -n
Currently the dashboard binds to the internal IP address so to see it you need to run an SSH port forward from your remote box to your local PC if you’re using EC2 or similar:
ssh firstname.lastname@example.org -L 80:localhost:80
WHAT NEEDS DOING?
A lot! We’re blazing a bit of a trail here and this charm is very rough around the edges and something we cooked up over a weekend, to make it production ready we need to add more configuration options, expose the correct services on the public IP addresses and support the rather important, multiple master nodes.
None of this is overly complex it just takes time. If you want to help jump on the juju mailing list and say hello, or get in contact via this website or the github projects, the more people helping the merrier on projects like this.
WHERE CAN I FIND OUT MORE?
To find out more, keep an eye on this blog, and if you’re in the Vancouver area in mid May, come to my talk at ApacheCon Big Data where we’ll be looking at DC/OS and a lot of other Apache technology powered by Juju.