mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-27 12:38:11 +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)
|
## 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:
|
Start InfraKit:
|
||||||
```
|
```
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
set -x
|
set -x
|
||||||
set -v
|
set -v
|
||||||
|
|
||||||
# --initial-cluster argument should come from meta data
|
|
||||||
|
|
||||||
# Wait till we have an IP address
|
# Wait till we have an IP address
|
||||||
IP=""
|
IP=""
|
||||||
while [ -z "$IP" ]; do
|
while [ -z "$IP" ]; do
|
||||||
@ -18,6 +16,10 @@ NUM=$(echo ${IP} | cut -d . -f 4)
|
|||||||
PREFIX=$(echo ${IP} | cut -d . -f 1,2,3)
|
PREFIX=$(echo ${IP} | cut -d . -f 1,2,3)
|
||||||
NAME=infra${NUM}
|
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 \
|
/usr/local/bin/etcd \
|
||||||
--name ${NAME} \
|
--name ${NAME} \
|
||||||
--debug \
|
--debug \
|
||||||
@ -27,13 +29,12 @@ NAME=infra${NUM}
|
|||||||
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
||||||
--advertise-client-urls http://${IP}:2379 \
|
--advertise-client-urls http://${IP}:2379 \
|
||||||
--initial-cluster-token etcd-cluster-1 \
|
--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
|
--initial-cluster-state new
|
||||||
|
|
||||||
echo "Returned $?"
|
[ $? -eq 0 ] && exit 0
|
||||||
|
|
||||||
# If we get here, joining a new cluster failed. Let's try joining an
|
# Joining the new cluster failed. Let's try joining an *existing* cluster
|
||||||
# existing cluster
|
|
||||||
/usr/local/bin/etcd \
|
/usr/local/bin/etcd \
|
||||||
--name ${NAME} \
|
--name ${NAME} \
|
||||||
--debug \
|
--debug \
|
||||||
@ -42,5 +43,5 @@ echo "Returned $?"
|
|||||||
--listen-peer-urls http://${IP}:2380 \
|
--listen-peer-urls http://${IP}:2380 \
|
||||||
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
||||||
--advertise-client-urls http://${IP}: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
|
--initial-cluster-state existing
|
||||||
|
@ -41,7 +41,7 @@ daemon:
|
|||||||
net: host
|
net: host
|
||||||
outputs:
|
outputs:
|
||||||
- format: kernel+initrd
|
- format: kernel+initrd
|
||||||
- format: gce
|
# - format: gcp
|
||||||
project: docker4x
|
# project: docker4x
|
||||||
bucket: rolf
|
# bucket: rolf
|
||||||
replace: true
|
# replace: true
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
{
|
{
|
||||||
"ID": "etcd",
|
"ID": "etcd.gcp",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"Allocation": {
|
"Allocation": {
|
||||||
"LogicalIDs": [
|
"LogicalIDs": [
|
||||||
"10.132.0.200",
|
"10.132.0.200",
|
||||||
"10.132.0.201",
|
"10.132.0.201",
|
||||||
"10.132.0.202"
|
"10.132.0.202",
|
||||||
|
"10.132.0.203",
|
||||||
|
"10.132.0.204"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Instance": {
|
"Instance": {
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
"LogicalIDs": [
|
"LogicalIDs": [
|
||||||
"192.168.65.200",
|
"192.168.65.200",
|
||||||
"192.168.65.201",
|
"192.168.65.201",
|
||||||
"192.168.65.202"
|
"192.168.65.202",
|
||||||
|
"192.168.65.203",
|
||||||
|
"192.168.65.204"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Instance": {
|
"Instance": {
|
||||||
|
Loading…
Reference in New Issue
Block a user