Running Kontena in the Google Cloud

 

Alternative Text by Maarten Hoogendoorn

In this blog post we’ll set up Kontena on top of CoreOS on GCE. In the previous blog, I described Kontena’s architecture.

Register an account

We’ll use the authentication service hosted by kontena.

To register an account, we need to install the command line interface. It’s packaged at the moment as a ruby gem, so make sure that ruby is installed.

I personally use this trick to install gems local to a project directory:

And install the cli, and register an account. Follow the instructions provided by the client.

Setting up the GCE instances.

We’ll adapt the instructions on how to set up a CoreOS cluster. I recommend to browse through them as well, to get a feeling of what we’re about to do.

Setup of the Kontena Master

  1. Create a master.yml file with the cloud config content described on the CoreOS cluster page.
  2. Follow the instructions to create random values for KONTENA_VAULT_KEY and KONTENA_VAULT_IV with the provided command cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1. Put them in the master.yml file.
  3. Now we should add a SSL certificate to encrypt the http traffic. If you’re going to deploy something else than an experiment, I strongly recomment to get a domain name, and get a valid certificate. A Let’s Encrypt certificate will do.

    We’ll create a self signed certificate for now, because we will not be using a domain name.

    Copy the content of kontena-master.pem in the master.yml file. Mind the indentation!

  4. Now we’ll create the master server. I picked the instructions on how to create a CoreOS stable instance from the CoreOS documentation.

    Find the external IP address of the master in the output from gcloud, and put it in an environmental variable.

  5. As the last step of setting up the master, we’ll log in to it. Note that we have to ignore the validity of our self-signed certificate. This is not how things should be done, but will get a fast result for a quick evaluation.

Creating a grid, and adding nodes to it.

  1. We’ll create a grid, a logical grouping of nodes, first.

  2. The next step is to generate a generic cloud-config.yml for the nodes:

  3. We finish with creating the nodes themselves using the gcloud tool:

Take a look at some of the provided example applications on GitHub. Clone the repo, go to one of the directories containing a kontena.yml file, and run kontena app deploy to deploy that application.

The following two tabs change content below.
Part time researcher at CS and finishing my master thesis at the Vrije Universiteit Amsterdam.

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *