Commit 8b99dd6f authored by Lénaïc Huard's avatar Lénaïc Huard

Get rid of the etcd discovery mechanism in favor of static configuration

In order to make the etcd instances of the VMs join into a single cluster, we used to use the discovery mechanism. This made the cluster bootstrap dependent on an external etcd cluster instance. 74601eab replaced the dependency on discovery.etcd.io by a local etcd cluster. This change completely gets rid of the dynamic discovery mechanism in favor of the static configuration method. This should be both safe and light since it completely removes the need of having an external etcd cluster running somewhere (either discovery.etcd.io, or locally).
parent 6fad7d35
...@@ -15,11 +15,12 @@ write_files: ...@@ -15,11 +15,12 @@ write_files:
coreos: coreos:
etcd2: etcd2:
discovery: ${discovery}
advertise-client-urls: http://${public_ip}:2379 advertise-client-urls: http://${public_ip}:2379
initial-advertise-peer-urls: http://${public_ip}:2380 initial-advertise-peer-urls: http://${public_ip}:2380
listen-client-urls: http://0.0.0.0:2379 listen-client-urls: http://0.0.0.0:2379
listen-peer-urls: http://${public_ip}:2380 listen-peer-urls: http://${public_ip}:2380
initial-cluster-state: new
initial-cluster: ${etcd2_initial_cluster}
units: units:
- name: static.network - name: static.network
command: start command: start
...@@ -70,6 +71,11 @@ coreos: ...@@ -70,6 +71,11 @@ coreos:
Type=oneshot Type=oneshot
- name: etcd2.service - name: etcd2.service
command: start command: start
drop-ins:
- name: 10-override-name.conf
content: |
[Service]
Environment=ETCD_NAME=%H
- name: docker.service - name: docker.service
command: start command: start
drop-ins: drop-ins:
......
...@@ -189,11 +189,18 @@ function kube-up { ...@@ -189,11 +189,18 @@ function kube-up {
readonly ssh_keys="$(cat ~/.ssh/id_*.pub | sed 's/^/ - /')" readonly ssh_keys="$(cat ~/.ssh/id_*.pub | sed 's/^/ - /')"
readonly kubernetes_dir="$POOL_PATH/kubernetes" readonly kubernetes_dir="$POOL_PATH/kubernetes"
readonly discovery=$(curl -s https://discovery.etcd.io/new?size=$(($NUM_MINIONS+1)))
local i
for (( i = 0 ; i <= $NUM_MINIONS ; i++ )); do
if [[ $i -eq $NUM_MINIONS ]]; then
etcd2_initial_cluster[$i]="${MASTER_NAME}=http://${MASTER_IP}:2380"
else
etcd2_initial_cluster[$i]="${MINION_NAMES[$i]}=http://${MINION_IPS[$i]}:2380"
fi
done
etcd2_initial_cluster=$(join , "${etcd2_initial_cluster[@]}")
readonly machines=$(join , "${KUBE_MINION_IP_ADDRESSES[@]}") readonly machines=$(join , "${KUBE_MINION_IP_ADDRESSES[@]}")
local i
for (( i = 0 ; i <= $NUM_MINIONS ; i++ )); do for (( i = 0 ; i <= $NUM_MINIONS ; i++ )); do
if [[ $i -eq $NUM_MINIONS ]]; then if [[ $i -eq $NUM_MINIONS ]]; then
type=master type=master
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment