demo: Add files/instructions for a GCP based etcd cluster

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-04-06 17:24:30 +01:00
parent 2bd75a621d
commit dca2b4d223
4 changed files with 105 additions and 5 deletions

37
projects/demo/README.md Normal file
View File

@ -0,0 +1,37 @@
This directory contains files used in moby demos.
# Prerequisites
Most of the scripts/files assume you are on a Mac.
- Recent Docker for Mac installed (edge, nightly, master channel)
- For the GCP portion: `brew install google-cloud-sdk`
- For `etcd`: `brew install etcd`
- Infrakit: Clone [infrakit](https://github.com/docker/infrakit) and
the [GCP plugin](https://github.com/docker/infrakit.gcp) for
infrakit. For each, `make build-in-container` and then copy the
contents of `./build` somewhere in your path.
# GCP Setup
You probably want to change the project/zone
```
export CLOUDSDK_CORE_PROJECT=docker4x
export CLOUDSDK_COMPUTE_ZONE=europe-west1-d
gcloud auth login
gcloud auth application-default login
```
You may also want to create ssh-keys and upload them. See the [Generating a new SSH key-pair section](https://cloud.google.com/compute/docs/instances/connecting-to-instance)
One time configuration of the network:
```
gcloud compute networks create rneugeba-demo --mode auto
gcloud compute networks subnets list
# get IP subnet for rneugeba-demo
gcloud compute firewall-rules create rneugeba-demo-internal --network \
rneugeba-demo --allow tcp,udp,icmp --source-ranges 10.128.0.0/9
```
The firewall setup means that all our projects networks can talk to the demo network.

View File

@ -6,7 +6,7 @@ Docker for Mac container to bootstrap the cluster. For a cloud based demo, we'd
The moby `etcd` package is build with [build-pkg.sh](./build-pkg.sh). It take the official `etcd` container and adds a [script](./etcd.sh) to start `etcd`.
## Simple single node cluster
## Simple single node cluster (OUTDATED)
- Edit `./dfm-setup.sh` and set `NUMPEERS` to `1`
- Start the etcd bootstrap container in on window:
@ -21,7 +21,7 @@ moby build etcd
moby run etcd
```
## InfraKit cluster setup
## InfraKit cluster setup (OUTDATED)
This should create a HyperKit based, InfraKit managed `etcd` cluster with 5 `etcd` instances.
@ -34,10 +34,10 @@ rm -rf ~/.infrakit
```
- Start the infrakit plugins, each in it's own window from the root of the infrakit source tree:
```
./build/infrakit-group-default
infrakit-group-default
```
```
./build/infrakit-flavor-vanilla
infrakit-flavor-vanilla
```
- Start the hyperkit instance plugin from this directory:
```
@ -53,7 +53,7 @@ rm -rf ~/.infrakit
- Commit the infrakit config:
```
~/src/docker/infrakit/build/infrakit group commit infrakit.json
infrakit group commit infrakit.json
```
To check if everything is fine, note down the IP address from one of
@ -61,3 +61,26 @@ the nodes and then:
```
docker run --rm -t quay.io/coreos/etcd:v3.1.5 etcdctl --endpoints http://192.168.65.24:2379 member list
```
## Infrakit GCP setup
Note: This setup is somewhat specific to our GCP setup (IP addresses
and account info) and needs to be adjusted to your setting. The
configuration is documented in the top-level README.md.
Build the image and upload it:
```
moby build etcd
```
Start the infrakit components in separate windows:
```
infrakit-group-default
infrakit-flavor-vanilla
infrakit-instance-gcp
```
Commit the configuration:
```
infrakit group commit infrakit-gce.json
```

View File

@ -40,3 +40,7 @@ daemon:
net: host
outputs:
- format: kernel+initrd
- format: gce
project: docker4x
bucket: rolf
replace: true

View File

@ -0,0 +1,36 @@
{
"ID": "etcd",
"Properties": {
"Allocation": {
"LogicalIDs": [
"10.132.0.200",
"10.132.0.201",
"10.132.0.202"
]
},
"Instance": {
"Plugin": "instance-gcp",
"Properties": {
"NamePrefix": "etcdtest",
"Description": "ETCD test cluster",
"Network": "rneugeba-demo",
"Connect" : true,
"MachineType": "n1-standard-1",
"DiskSizeMb": 60,
"DiskImage": "https://www.googleapis.com/compute/v1/projects/docker4x/global/images/etcd",
"DiskType": "pd-standard",
"Scopes": [ ]
}
},
"Flavor": {
"Plugin": "flavor-vanilla",
"Properties": {
"Init": [ ],
"Tags": {
"tier": "etcd-cluster",
"project": "infrakit"
}
}
}
}
}