As application container adoption continues to grow, the popularity of ‘minimal’ operating systems, designed to run containers, is on the rise. One such operating system is CoreOS. CoreOs has been architected to run modern, cloud native applications and provide support for Docker containers.
In this post, I will describe how Nirmata can be used to deploy and operate microservices applications on CoreOS. The high level steps are simple:
- Create a Host Group
- Setup a CoreOS VM
- Deploy an application
I will describe each step in detail below.
Create a Host Group
In Nirmata, a Host Group is a pool of identical resources. You can define one or more, Host Groups for each Cloud Provider, and then map Host Groups to application and service level policies.
Nirmata supports several public and private cloud providers. For this setup, I will use the ‘Other’ provider type and directly connect individual CoreOS instances to my Host Group.
The first step is to create a new host group in Nirmata for my CoreOS VMs. This can be done by going to Host Groups->Other and clicking on the Add Host Group button. In the wizard, I can specify the name for my host group and there resource selection policy.
In the resource selection policy, I select ‘Sandbox’ as the environment type and ‘availableMemory’ as the placement type. This policy ensures that whenever an application in deployed in the ‘Sandbox’ environment, the CoreOS cluster is used and the containers are placed based on the memory available on the VMs within the cluster.
Once this host group is created, I can now add my CoreOS VMs to the cluster. The CLI command to setup VMs to connect to Nirmata and to be added to this host group is also displayed.
Setup a CoreOS VM
To set up my CoreOS VMs for use with Nirmata, I can ssh to the VM and run the command to setup my VMs to connect to Nirmata and be added to my host group. The command also displayed on the host group page:
<strong><strong> </strong></strong>sudo curl -sSL http://www.nirmata.io/nirmata-host-agent/setup-nirmata-agent.sh | sudo sh -s other <host-group-id>
This command will download the host agent container image and run it as a systemd service.
You can verify that the host agent is running using the docker ps command:
Once the host agent is running, it will connect to Nirmata and the host will be added to the host group
You can repeat this steps to add multiple CoreOS VMs to your host group. I added one more VM to my host group so my CoreOS cluster has 2 VMs.
Deploy your application
Now, I am ready to deploy my application. I have imported a small demo application with 6 services in Nirmata.
To create an environment to deploy this application, go to Environments and click on Add Environment. In the wizard, select the environment type as ‘Sandbox’ and the application as ‘shopme-demo’.
Click Finish to start deploying the environment. You should see the containers (services) getting deployed.
In a few minutes, all the services are deployed and are running.
I can verify this by going to the host group view and viewing the hosts. I can see that each host has 3 containers deployed.
I can also verify that my containers are deployed by checking my VMs.
Once my application is deployed, I can actively monitor it and manage it from Nirmata. I can easily add additional hosts to my host group as well as scale up or scale down my containers.
As you can see, within a few minutes you can create a cluster of VMs and deploy a distributed application with Nirmata. Once deployed, the application can also be easily monitored and managed. Give it a try and let us know what you think!