---
title: Running Kontena in the Google Cloud
description: In this blog post we'll set up Kontena on top of CoreOS on GCE. In the previous blog, I described Kontena's architecture. We'll use the authentication service hosted by kontena. To register an account, we need to install the command line interface.
image: http://cdn2.hubspot.net/hubfs/2668666/All-InOne-2016/Image/bg-img.jpg
---

Check out our **[Cloud Native Services](https://www.container-solutions.com/services) **and** **book a call with one of our experts today! 

[![Container Solutions](https://blog.container-solutions.com/hubfs/CS_blog/logo-main.svg "Container Solutions")](http://container-solutions.com)

- share:
- [**](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fblog.container-solutions.com%2Frunning-kontena-google-cloud)
- [**](https://www.twitter.com/share?url=https%3A%2F%2Fblog.container-solutions.com%2Frunning-kontena-google-cloud)
- [**](http://www.linkedin.com/shareArticle?mini=true&url=https://blog.container-solutions.com/running-kontena-google-cloud)
- [**](https://blog.container-solutions.com/running-kontena-google-cloud#)

[![](http://cdn2.hubspot.net/hubfs/2668666/All-InOne-2016/Image/bg-img.jpg) ](https://blog.container-solutions.com/running-kontena-google-cloud)

[Miscellaneous](https://blog.container-solutions.com/tag/miscellaneous)

# Running Kontena in the Google Cloud

[Maarten Hoogendoorn](https://blog.container-solutions.com/author/maarten-hoogendoorn)

![Maarten Hoogendoorn](https://blog.container-solutions.com/hubfs/CS--Dev__Assets/asset%2011.jpeg)

 October 19, 2016

 6 minutes Read

In this blog post we'll set up Kontena on top of CoreOS on GCE. In the [previous blog](https://container-solutions.com/kontena-alternative-container-orchestrator), 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:

```
  
cat env.sh
(out) export GEM_HOME=`pwd`/.gems
(out) export PATH=$PATH:`pwd`/.gems/bin
source env.sh # evaluate the exports in the current shell
```

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

```
  
gem install kontena-cli
kontena register
```

### Setting up the GCE instances.

We'll adapt the instructions on how to set up a [CoreOS cluster](https://kontena.io/docs/getting-started/installing/coreos). 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](https://letsencrypt.org/) certificate will do.
   
   We'll create a self signed certificate for now, because we will not be using a domain name.
   
   ```
     
   openssl genrsa -out private.key 2048
   openssl req -new -key private.key -out public.csr -subj "/CN=kontena-master/"
   openssl x509 -req -days 365 -in public.csr -signkey private.key -out public.crt
   cat public.crt private.key > kontena-master.pem
   cat kontena-master.pem
   ```
   
   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](https://coreos.com/os/docs/latest/booting-on-google-compute-engine.html).
   
   ```
     
   gcloud compute instances create kontena-master \
   (out)    --image https://www.googleapis.com/compute/v1/projects/coreos-cloud/global/images/coreos-stable-1122-2-0-v20160906 \
   (out)    --zone europe-west1-b \
   (out)    --machine-type n1-standard-1 \
   (out)    --metadata-from-file user-data=master.yml \
   (out)    --tags=http-server,https-server
   ```
   
   Find the external IP address of the master in the output from gcloud, and put it in an environmental variable.
   
   ```
     
   export KONTENA_MASTER_IP=aaa.bbb.ccc.ddd
   	
   ```
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.
   
   ```
     
   SSL_IGNORE_ERRORS=true kontena login --name kontena-master-gce https://$KONTENA_MASTER_IP
   ```

### Creating a grid, and adding nodes to it.

1. We'll create a grid, a logical grouping of nodes, first.
   
   ```
     
   SSL_IGNORE_ERRORS=true kontena grid create testgrid
   ```
2. The next step is to generate a generic cloud-config.yml for the nodes:
   
   ```
     
   SSL_IGNORE_ERRORS=true kontena grid cloud-config testgrid > grid_node.yml
   ```
3. We finish with creating the nodes themselves using the gcloud tool:
   
   ```
     
   gcloud compute instances create \
   (out)     kontena-testgrid-node1 \
   (out)     --image https://www.googleapis.com/compute/v1/projects/coreos-cloud/global/images/coreos-stable-1122-2-0-v20160906 \
   (out)     --zone europe-west1-b \
   (out)     --machine-type n1-standard-1 \
   (out)     --metadata-from-file user-data=grid_node.yml \
   (out)     --tags=http-server,https-server
   (out)
   gcloud compute instances create \
   (out)     kontena-testgrid-node2 \
   (out)     --image https://www.googleapis.com/compute/v1/projects/coreos-cloud/global/images/coreos-stable-1122-2-0-v20160906 \
   (out)     --zone europe-west1-b \
   (out)     --machine-type n1-standard-1 \
   (out)     --metadata-from-file user-data=grid_node.yml \
   (out)     --tags=http-server,https-server
   
   gcloud compute instances create \
   (out)     kontena-testgrid-node3 \
   (out)     --image https://www.googleapis.com/compute/v1/projects/coreos-cloud/global/images/coreos-stable-1122-2-0-v20160906 \
   (out)     --zone europe-west1-b \
   (out)     --machine-type n1-standard-1 \
   (out)     --metadata-from-file user-data=grid_node.yml \
   (out)     --tags=http-server,https-server
   ```

 nten

Take a look at some of the provided [example applications](https://github.com/kontena/examples) 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.

[### Kontena: an alternative container orchestrator

](https://blog.container-solutions.com/kontena-alternative-container-orchestrator)

[![prev-arrow](https://cdn2.hubspot.net/hubfs/3842749/Wow%202019/Images/left-arrow.png) Previous article](https://blog.container-solutions.com/kontena-alternative-container-orchestrator)

[ Next article ![next-arrow](https://cdn2.hubspot.net/hubfs/3842749/Wow%202019/Images/right-arrow.png) ](https://blog.container-solutions.com/continuous-integration-deployment-micro-services-different-platforms)

[

### Continuous Integration of deployment of micro-services to di...

](https://blog.container-solutions.com/continuous-integration-deployment-micro-services-different-platforms)

Comments

Leave your Comment

![cs-logo-white](https://blog.container-solutions.com/hs-fs/hubfs/cs-logo-white.png?width=150&height=61&name=cs-logo-white.png "cs-logo-white")

#### **Talk to sales**

[info@container-solutions.com](mailto:info@container-Solutions.com)

#### Stay In Touch

- [**](https://www.linkedin.com/company/container-solutions/)
- [**](https://twitter.com/containersoluti)

© 2024 Container Solutions