What is Tutum?
Tutum, an awesome piece of work, can be described as an orchestration platform for containerized applications. You select the hosting infrastructure provider, and let Tutum manage the container work-flow. It has native support for Amazon Web Services, Digital Ocean and Azure. What this means is, that Tutum will automatically create the compute host (virtual machine in this case) to run the containerized applications using docker.
Additionally, it also supports bring-your-node (BYON) concept, which enables you to bring any internet accessible compute host (baremetal or virtual machine), and add it to Tutum for container management. As of this writing, the only restriction is, that the node should run Ubuntu 14.04. We can leverage BYON functionality to add any hosting provider, which are not natively supported, for example, Softlayer, Rackspace, etc. This enables to leverage the benefits of Tutum as a container orchestration platform on any hosting provider.
[Update – Softlayer has now been natively integrated with Tutum]
Some Key Tutum Terms
A service is a group of containers having the same image:tag. Services make it simple to scale and manage your application.
A node is an individual Linux host used to deploy and run your applications. These hosts can come from different sources, such as physical servers, virtual machines or cloud providers.
Easy to use docker images provided by Tutum
These are used to target the deployment of services to a specific set of nodes. Using deploy tags, you can control the provisioning work-flow of the containers.
Using AWS and Softlayer with Tutum
A Tutum work-flow primarily comprises of the following high level steps:
- Add an Infrastructure Provider
- Create a node
- Create and Deploy a Service
- Manage the Service
Lets go through step 1-3 in details w.r.to AWS and Softlayer. For step-4, we’ll take the example of load-balancing the service across AWS and Softlayer.
Adding AWS as an Infrastructure provider for Tutum.
Since AWS is supported natively by Tutum, adding it as an infrastructure provider is straight forward.
To add AWS as a provider, navigate to Account info > Cloud Providers. Click Add credentials and provide the Access Key ID and the Secret Access Key.
Create an AWS node cluster
This will create an AWS instance with docker installed. Specify ”Deploy tags’ to control the container provisioning work-flow. In this example ‘aws’ tag is used. We can specify multiple tags if required.
Create the node cluster by clicking on ‘Launch node cluster’. After successful creation of the node, we should see something like this
Adding Softlayer as an Infrastructure provider for Tutum
Since there is no native support for Softlayer in Tutum, we’ll make use of the bring-your-own-node functionality to add a Softlayer hosted node
Navigate to the ‘Nodes’ tab and click ‘Bring your own node’.
We’ll get a screen like the one shown below, providing the next steps.
Executing the above mentioned command on my Softlayer VM installs the tutum-agent and adds the node to Tutum.
root@pradipta:~# curl -Ls https://files.tutum.co/scripts/install-agent.sh | sudo -H sh -s 5358c2eae224423d8fd6ecc7fb78545a
-> Adding Tutum’s GPG key…
-> Installing tutum-agent…
-> Configuring tutum-agent…
Tutum Agent installed successfully
This installs the tutum-agent and docker binary on the VM. The docker binary is installed under /usr/lib/tutum.
root@pradipta:~# ps x | grep tutum
8439 pts/0 S+ 0:00 grep –color=auto tutum
17913 ? Ssl 0:01 /usr/bin/tutum-agent
17922 ? Sl 0:11 /usr/lib/tutum/docker -d -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock –tlscert /etc/tutum/agent/cert.pem –tlskey /etc/tutum/agent/key.pem –tlscacert /etc/tutum/agent/ca.pem –tlsverify
The node dashboard should show two nodes now – one from AWS and another from Softlayer
Add ‘Deploy tags’ to the Softlayer node by clicking on the specific node entry and adding the relevant tags as shown below.
And that is all. The Softlayer node can now be used by Tutum for container orchestration.
Create a Service
Clicking the ‘Services’ tab should show the following screen if this is the first service.
Clicking on ‘Create your first service’ will take us to the service creation wizard
Tutum provides lots of ready-to-use images (called jumpstart) that can be used to get a feel of Tutum’s features. For this writeup, I have used the tutum/hello-world image.
Selecting the image takes us to the next step where we can specify the service name, number of containers and deploy tags to identify the node cluster for container deployment.
To ensure, that service gets created on the Softlayer node, we need to use the right ‘Deploy tag’. In this case, it’s ‘softlayer-cluster’ tag’. Similarly, for creating the service on the AWS node, we need to specify ‘aws’ as the ‘Deploy tag’.
Clicking ‘Create and deploy’ will create and deploy the service on my Softlayer node. The service dashboard will show the complete details.
Clicking on the container name will take us to the endpoints view, listing the service access URL as shown in the screenshot below.
Clicking the icon in the end, will open a new tab displaying the output of the ‘hello-world’ service.
We can even list the running containers on the Softlayer node.
There are some additional containers, that are running, alongside hello-world. These are started by Tutum to collect node and container metrics and for other other house keeping stuff.
Once the service is created, we can manage the same via Tutum. It’s extremely easy to work with Tutum.
Manage a Service
We’ll add a load balancer service to the two hello-world services created earlier, one running on AWS and another on Softlayer.
Click ‘Create Service’ and select tutum/haproxy from Jumpstart images (under Proxies)
Select the image and in the next ‘Service configuration’ screen, we’ll set the node port to 80.
We need to select the ‘Environment variables’ option to configure other aspects required for linking the haproxy service to the two hello-world services. We’ll see something similar like the screenshot below:
The most important piece is the ‘API roles’ and the ‘Link services’ option.
Setting the ‘API roles’ to ‘Full access’ will allow the service’s associated containers to query Tutum API, thereby allowing tutum/haproxy to retrieve the number of linked services and other information programmatically. This is then used by haproxy to dynamically update its configuration based on the scaling of the linked services.
The ‘Link services’ allows us to add the services to be load-balanced. In the example here, we add both the hello-world services created earlier.
Clicking ‘Create and deploy’ will start the service creation and deployment. On successful deployment, the following gets displayed
Clicking on haproxy-01a50c18-1 will take us to the container view showing the endpoints, similar to the screenshot below
Clicking on the icon at the end of the URL will open a new tab, and display the output from the hello-world service. Refreshing the tab will oscillate between the two different hosts.
I must say, that AWS Free tier and Tutum (which is free currently) is a terrific combination for anyone wanting to do development and prototyping on containers