mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
demo: Create a cluster of 5 etcd daemons
Also tweak the shell script a little and give the local and GCP infrakit group different names. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
9878cabd1e
commit
c660ca5ac4
@ -15,7 +15,7 @@ moby build etcd
|
||||
|
||||
## InfraKit cluster setup (OUTDATED)
|
||||
|
||||
This should create a HyperKit based, InfraKit managed `etcd` cluster with 3 `etcd` instances.
|
||||
This should create a HyperKit based, InfraKit managed `etcd` cluster with 5 `etcd` instances.
|
||||
|
||||
Start InfraKit:
|
||||
```
|
||||
|
@ -4,8 +4,6 @@
|
||||
set -x
|
||||
set -v
|
||||
|
||||
# --initial-cluster argument should come from meta data
|
||||
|
||||
# Wait till we have an IP address
|
||||
IP=""
|
||||
while [ -z "$IP" ]; do
|
||||
@ -18,6 +16,10 @@ NUM=$(echo ${IP} | cut -d . -f 4)
|
||||
PREFIX=$(echo ${IP} | cut -d . -f 1,2,3)
|
||||
NAME=infra${NUM}
|
||||
|
||||
# This should come from Metadata
|
||||
INIT_CLUSTER=infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2380,infra202=http://${PREFIX}.202:2380,infra203=http://${PREFIX}.203:2380,infra204=http://${PREFIX}.204:2380
|
||||
|
||||
# Try to start in *new* cluster mode
|
||||
/usr/local/bin/etcd \
|
||||
--name ${NAME} \
|
||||
--debug \
|
||||
@ -27,13 +29,12 @@ NAME=infra${NUM}
|
||||
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
||||
--advertise-client-urls http://${IP}:2379 \
|
||||
--initial-cluster-token etcd-cluster-1 \
|
||||
--initial-cluster infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2380,infra202=http://${PREFIX}.202:2380 \
|
||||
--initial-cluster ${INIT_CLUSTER} \
|
||||
--initial-cluster-state new
|
||||
|
||||
echo "Returned $?"
|
||||
[ $? -eq 0 ] && exit 0
|
||||
|
||||
# If we get here, joining a new cluster failed. Let's try joining an
|
||||
# existing cluster
|
||||
# Joining the new cluster failed. Let's try joining an *existing* cluster
|
||||
/usr/local/bin/etcd \
|
||||
--name ${NAME} \
|
||||
--debug \
|
||||
@ -42,5 +43,5 @@ echo "Returned $?"
|
||||
--listen-peer-urls http://${IP}:2380 \
|
||||
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
||||
--advertise-client-urls http://${IP}:2379 \
|
||||
--initial-cluster infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2380,infra202=http://${PREFIX}.202:2380 \
|
||||
--initial-cluster ${INIT_CLUSTER} \
|
||||
--initial-cluster-state existing
|
||||
|
@ -41,7 +41,7 @@ daemon:
|
||||
net: host
|
||||
outputs:
|
||||
- format: kernel+initrd
|
||||
- format: gce
|
||||
project: docker4x
|
||||
bucket: rolf
|
||||
replace: true
|
||||
# - format: gcp
|
||||
# project: docker4x
|
||||
# bucket: rolf
|
||||
# replace: true
|
||||
|
@ -1,11 +1,13 @@
|
||||
{
|
||||
"ID": "etcd",
|
||||
"ID": "etcd.gcp",
|
||||
"Properties": {
|
||||
"Allocation": {
|
||||
"LogicalIDs": [
|
||||
"10.132.0.200",
|
||||
"10.132.0.201",
|
||||
"10.132.0.202"
|
||||
"10.132.0.202",
|
||||
"10.132.0.203",
|
||||
"10.132.0.204"
|
||||
]
|
||||
},
|
||||
"Instance": {
|
||||
|
@ -5,7 +5,9 @@
|
||||
"LogicalIDs": [
|
||||
"192.168.65.200",
|
||||
"192.168.65.201",
|
||||
"192.168.65.202"
|
||||
"192.168.65.202",
|
||||
"192.168.65.203",
|
||||
"192.168.65.204"
|
||||
]
|
||||
},
|
||||
"Instance": {
|
||||
|
Loading…
Reference in New Issue
Block a user