How To Set Up Kontena on DigitalOcean

Introduction

Kontena is a new developer friendly platform for orchestrating applications that are run on Docker containers. It simplifies deploying and running containerized applications on any infrastructure. By leveraging technologies such as Docker, CoreOS and Weave, it provides complete solution for organizations of any size.

Kontena is built to maximize developer happiness; it is designed for application developers and therefore does not require ops teams to setup or maintain. It is an ideal choice for start-ups, small-to-medium sized businesses and organizations without deep knowledge (or interest) of configuring and maintaining scalable application infrastructure.

To accelerate and break barriers for containerized application development, Kontena features some of the most essential technologies built-in such as load balancer, private Docker image repository and VPN access to isolated backend containers. In addition, Kontena has features to support most common PaaS workflows similar to Heroku. Kontena supports any application that can run in a Docker container, and can run on any machine that supports CoreOS.

In this tutorial, we will show you how to set up Kontena on DigitalOcean.

Prerequisites

To complete this tutorial you must have the following:

  • Kontena CLI Tool installed
  • Kontena User Account to complete new Kontena Master setup. If you don't have Kontena User Account already, you can create one for yourself with Kontena CLI using command kontena register.
  • DigitalOcean Account with ability to create at least 3 Droplets. We will provision those Droplets using the Kontena CLI.
    • 1 x Droplet for Kontena Master with at minimum 512MB memory and 20GB disk space
    • 2 x Droplet for Kontena Nodes with at minimum 1GB memory and 30GB disk space
  • Access Token for accessing DigitalOcean API with Kontena CLI. You can generate this token using DigitalOcean management console under the API menu.
  • SSH Key that can be used to access the Droplets we will create.

This tutorial is based on Getting Started with Kontena - Quick Start. If you have trouble following the steps in this tutorial, please review the original Quick Start documentation.

Step 1. Install DigitalOcean plugin

In order to provision DigitalOcean Droplets using Kontena CLI, DigitalOcean plugin is needed:

$ kontena plugin install digitalocean

Step 2. Create Kontena Master

First, we need to create Kontena Master. Kontena Master is a machine taking care of orchestration and providing management access to your containers. In addition, it is collecting log streams and statistics from all the nodes.

$ kontena digitalocean master create --token <ACCESS_TOKEN> \
                                     --ssh-key <PATH_TO_SSH_PUBLIC_KEY>
Creating DigitalOcean Droplet kontena-master-cold-bush-1... done  
Waiting for kontena-master-cold-bush-1 to start... done  
Kontena Master is now running at https://40.112.17.11  
Use kontena login https://40.112.17.11 to complete Kontena Master setup  

The ACCESS_TOKEN must be generated and obtained from DigitalOcean management console. The PATH_TO_SSH_PUBLIC_KEY is a path to your public SSH key used when accessing the Kontena Master Droplet via SSH (if needed).

Step 3. Login to New Kontena Master

After the Kontena Master provisioning is finished, you must login to your new Kontena Master. This is required since the first person will become an administrator of this Kontena Master. Additionally, we need to create a context - Kontena Grid - for our Nodes before they can be provisioned.

The login to Kontena Master is done with kontena login command. The command will take the address of your Kontena Master as an argument. Use the address you obtained in previous step.

NOTE! You will need to use your personal Kontena User Account credentials when logging in to Kontena Master.

$ kontena login https://40.112.17.11
Email: your.email@domain.com  
Password: *********  
 _               _
| | _ ___  _ __ | |_ ___ _ __   __ _
| |/ / _ \| '_ \| __/ _ \ '_ \ / _` |
|   < (_) | | | | ||  __/ | | | (_| |
|_|\_\___/|_| |_|\__\___|_| |_|\__,_|
-------------------------------------
Copyright (c)2015 Kontena, Inc.

Logged in as your.email@domain.com  
Welcome! See 'kontena --help' to get started.  

Step 4. Create a Grid

Once logged in, you'll need to create a Grid that will be used in the next step when installing Kontena Nodes. The Grid can be created with command kontena grid create. You can give the name for your grid as argument for this command. In the example below, we will create a Grid with a name testing.

$ kontena grid create testing
Using grid: testing  

Step 5. Create Kontena Nodes

When Kontena Master setup is complete, we are ready to create some Kontena Nodes. In this tutorial we will create 2 Kontena Nodes that are used to run your containerized workloads. Naturally, you can provision more nodes if needed, but having 2 nodes is a good start! The process of creating a Kontena Node is very similar to Kontena Master. The newly created Kontena Nodes will automatically join to Grid we created in the previous step.

$ kontena digitalocean node create --token <ACCESS_TOKEN> \
                                   --ssh-key <PATH_TO_SSH_PUBLIC_KEY>
Creating DigitalOcean droplet kontena-node-twilight-hill-98... done  
Waiting for node kontena-node-twilight-hill-98 join to grid testing... done  

Just like with Kontena Master create, the ACCESS_TOKEN must be generated and obtained from DigitalOcean management console. The PATH_TO_SSH_PUBLIC_KEY is a path to your public SSH key used when accessing the Kontena Node Droplet via SSH (if needed).

You can repeat this step to provision additional Kontena Nodes to your Grid.

Note! While Kontena works ok even with just single Kontena Node, it is recommended to have at least 2 Kontena Nodes provisioned in a Grid.

Step 6. Verify Installation

Now, we should have a working Kontena environment setup. We can verify the setup using kontena node list command. It should list all the Kontena Nodes belonging to your grid provisioned in the previous step.

$ kontena node list

This completes setting up Kontena on DigitalOcean. Enjoy!