Deis installed Google Compute Engine

Note: This article translated from Deis official documents, without any commercial purposes, reproduced please indicate the source.

We will build a Deis cluster in Google Compute Engine!
Please read this article and get the source code and refer to the script in contrib / gce .

Necessary condition

In order to open the VM instance, let's start with some Google stuff.

Install the Google Cloud SDK

Install the Google Cloud SDK . You must sign in with your Google account:
shell
$ gcloud auth login

Create a new project

Create a new item in the Google Developers Console . You will get a project ID similar to orbital-gantry-285. We will use it as the default for the SDK tool:
shell
$ gcloud config set project orbital-gantry-285

Turn on billing

<Dl>
<Dt> Important </ dt>
<Dd> Once you create a resource, such as a hard disk, the instance will begin to incur costs. </ Dd>
</ Dl>
In the browser, click into the project console and go to the " Billing & Settings " section. Click the " Enable billing " button and fill out the form. It is necessary to create a resource in the GoogleCompute Engine.

Initialize Compute Engine

Google Compute Engine can only be accessed through the command line tool only if it is initialized on the web console. In the project console, click COMPUTE -> COMPUTE ENGINE -> VM Instances . Compute Engine will take some time to initialize, and then ready to create resources through gcutil.

Cloud initialization

Create your cloud initialization file with Deis' contrib / gce / create-gce-user-data script and create a new etcd discovery URL. First, install PyYAML:
shell
$ sudo pip install pyyaml

Then go to the contrib / gce directory:
shell
$ cd contrib/gce

Finally, create the gce-user-data file:

shell
$ ./create-gce-user-data $(curl -s https://discovery.etcd.io/new)

We will have a gce-user-data file for starting the CoreOS node.

Start the instance

Generate an SSH key for Deis host communication:
shell
$ ssh-keygen -q -t rsa -f ~/.ssh/deis -N '' -C deis

Create some persistent hard disks used by / var / lib / docker. CoreOS default root partition is only about 4GB, not enough to save the Docker mirror and instance. The following command will create three 32GB hard disks:
shell
$ gcutil adddisk --zone us-central1-a --size_gb 32 cored1 cored2 cored3
Table of resources:
+--------+---------------+--------+---------+
| name | zone | status | size-gb |
+--------+---------------+--------+---------+
| cored1 | us-central1-a | READY | 32 |
+--------+---------------+--------+---------+
| cored2 | us-central1-a | READY | 32 |
+--------+---------------+--------+---------+
| cored3 | us-central1-a | READY | 32 |
+--------+---------------+--------+---------+

Start 3 instances. You can select another boot CoreOS image from the gcloud compute images list list output:
shell
$ for num in 1 2 3; do gcutil addinstance --image projects/coreos-cloud/global/images/coreos-alpha-494-0-0-v20141108 --persistent_boot_disk --zone us-central1-a --machine_type n1-standard-2 --tags deis --metadata_from_file user-data:gce-user-data --disk cored${num},deviceName=coredocker --authorized_ssh_keys=core:~/.ssh/deis.pub,core:~/.ssh/google_compute_engine.pub core${num}; done
Table of resources:
+-------+---------------+--------------+---------------+---------+
| name | network-ip | external-ip | zone | status |
+-------+---------------+--------------+---------------+---------+
| core1 | 10.240.33.107 | 23.236.59.66 | us-central1-a | RUNNING |
+-------+---------------+--------------+---------------+---------+
| core2 | 10.240.94.33 | 108.59.80.17 | us-central1-a | RUNNING |
+-------+---------------+--------------+---------------+---------+
| core3 | 10.240.28.163 | 108.59.85.85 | us-central1-a | RUNNING |
+-------+---------------+--------------+---------------+---------+

<Dl>
<Dt> attention </ dt>
<Dd> The script opens the n1-standard-2 instance by default. It is not recommended to choose a smaller instance specification. Please refer to the resource requirements in "<a href=" http://docs.deis.io/en/latest/ … 6" and "System Requirements </a>" when selecting the instance specification for running Deis. </ Dd>
</ Dl>

Load balancing

The deisctl tool uses the SSH tunnel to communicate with the remote host. If you do not have an SSH key, the following command will generate a key pair named deis:
shell
$ ssh-keygen -q -t rsa -f ~/.ssh/deis -N '' -C deis

Generate a new discovery URL

We need load balancing the Deis routing to access Deis services (controllers and builders) and our applications.
shell
$ gcutil addhttphealthcheck basic-check --request_path /health-check
$ gcutil addtargetpool deis --health_checks basic-check --region us-central1 --instances core1,core2,core3
$ gcutil addforwardingrule deisapp --region us-central1 --target_pool deis
Table of resources:
+---------+-------------+--------------+
| name | region | ip |
+---------+-------------+--------------+
| deisapp | us-central1 | 23.251.153.6 |
+---------+-------------+--------------+

Note the forwarding network's IP address. We need to use it as a follow-up step for the Deis login endpoint. Now, open the port of the CoreOS node:
shell
$ gcutil addfirewall deis-router --target_tags deis --allowed &quot;tcp:80,tcp:2222&quot;

Configure DNS

We can use the gcloud tool to create DNS records in Google Cloud DNS. In this example, we will use deisdemo.io as the domain name. Create zone:
shell
$ gcloud dns managed-zone create --dns_name deisdemo.io. --description &quot;Example Deis cluster domain name&quot; deisdemoio
Creating {'dnsName': 'deisdemo.io.', 'name': 'deisdemoio', 'description':
'Example Deis cluster domain name'} in eco-theater-654
Do you want to continue (Y/n)? Y
{
&quot;creationTime&quot;: &quot;2014-07-28T00:01:45.835Z&quot;,
&quot;description&quot;: &quot;Example Deis cluster domain name&quot;,
&quot;dnsName&quot;: &quot;deisdemo.io.&quot;,
&quot;id&quot;: &quot;1374035518570040348&quot;,
&quot;kind&quot;: &quot;dns#managedZone&quot;,
&quot;name&quot;: &quot;deisdemoio&quot;,
&quot;nameServers&quot;: [
&quot;ns-cloud-d1.googledomains.com.&quot;,
&quot;ns-cloud-d2.googledomains.com.&quot;,
&quot;ns-cloud-d3.googledomains.com.&quot;,
&quot;ns-cloud-d4.googledomains.com.&quot;
]
}

Note the array of nameServers in the JSON output. We need to set the upstream domain name server to these values.
Now edit zone to add Deis endpoint and wildcard DNS:
shell
$ gcloud dns records --zone deisdemoio edit
{
&quot;additions&quot;: [
{
&quot;kind&quot;: &quot;dns#resourceRecordSet&quot;,
&quot;name&quot;: &quot;deisdemo.io.&quot;,
&quot;rrdatas&quot;: [
&quot;ns-cloud-d1.googledomains.com. dns-admin.google.com. 2 21600 3600 1209600 300&quot;
],
&quot;ttl&quot;: 21600,
&quot;type&quot;: &quot;SOA&quot;
}
],
&quot;deletions&quot;: [
{
&quot;kind&quot;: &quot;dns#resourceRecordSet&quot;,
&quot;name&quot;: &quot;deisdemo.io.&quot;,
&quot;rrdatas&quot;: [
&quot;ns-cloud-d1.googledomains.com. dns-admin.google.com. 1 21600 3600 1209600 300&quot;
],
&quot;ttl&quot;: 21600,
&quot;type&quot;: &quot;SOA&quot;
}
]
}

You need to add two records using the JSON object. This is an example of an edit adding two A records:
json
{
&quot;additions&quot;: [
{
&quot;kind&quot;: &quot;dns#resourceRecordSet&quot;,
&quot;name&quot;: &quot;deisdemo.io.&quot;,
&quot;rrdatas&quot;: [
&quot;ns-cloud-d1.googledomains.com. dns-admin.google.com. 2 21600 3600 1209600 300&quot;
],
&quot;ttl&quot;: 21600,
&quot;type&quot;: &quot;SOA&quot;
},
{
&quot;kind&quot;: &quot;dns#resourceRecordSet&quot;,
&quot;name&quot;: &quot;deis.deisdemo.io.&quot;,
&quot;rrdatas&quot;: [
&quot;23.251.153.6&quot;
],
&quot;ttl&quot;: 21600,
&quot;type&quot;: &quot;A&quot;
},
{
&quot;kind&quot;: &quot;dns#resourceRecordSet&quot;,
&quot;name&quot;: &quot;*.dev.deisdemo.io.&quot;,
&quot;rrdatas&quot;: [
&quot;23.251.153.6&quot;
],
&quot;ttl&quot;: 21600,
&quot;type&quot;: &quot;A&quot;
}
],
&quot;deletions&quot;: [
{
&quot;kind&quot;: &quot;dns#resourceRecordSet&quot;,
&quot;name&quot;: &quot;deisdemo.io.&quot;,
&quot;rrdatas&quot;: [
&quot;ns-cloud-d1.googledomains.com. dns-admin.google.com. 1 21600 3600 1209600 300&quot;
],
&quot;ttl&quot;: 21600,
&quot;type&quot;: &quot;SOA&quot;
}
]
}

Install the Deis platform

Now that you have completed the cluster, please refer to " Installing the Deis Platform " to start the platform installation.

Heads up! This alert needs your attention, but it's not super important.