From 28c95f3255162d91dc4237231daeaa3aa41be9f9 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Sun, 14 Aug 2016 18:28:10 -0700 Subject: [PATCH] Add etcd3 example cluster with rkt --- README.md | 2 +- examples/README.md | 1 + examples/groups/etcd/default.json | 2 +- examples/groups/etcd3/default.json | 8 ++++++ examples/groups/etcd3/node1.json | 13 ++++++++++ examples/groups/etcd3/node2.json | 13 ++++++++++ examples/groups/etcd3/node3.json | 13 ++++++++++ examples/ignition/etcd3-proxy.yaml | 37 +++++++++++++++++++++++++++ examples/ignition/etcd3.yaml | 41 ++++++++++++++++++++++++++++++ examples/profiles/etcd3-proxy.json | 15 +++++++++++ examples/profiles/etcd3.json | 15 +++++++++++ 11 files changed, 158 insertions(+), 2 deletions(-) create mode 100644 examples/groups/etcd3/default.json create mode 100644 examples/groups/etcd3/node1.json create mode 100644 examples/groups/etcd3/node2.json create mode 100644 examples/groups/etcd3/node3.json create mode 100644 examples/ignition/etcd3-proxy.yaml create mode 100644 examples/ignition/etcd3.yaml create mode 100644 examples/profiles/etcd3-proxy.json create mode 100644 examples/profiles/etcd3.json diff --git a/README.md b/README.md index 77cd3814..0ef61e93 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ The [examples](examples) network boot and provision CoreOS clusters. Network boo * Multi-node [Kubernetes cluster](Documentation/kubernetes.md) * Multi-node Kubernetes cluster with rkt container runtime (i.e. rktnetes) * Multi-node [self-hosted Kubernetes cluster](Documentation/bootkube.md) -* Multi-node etcd cluster +* Multi-node etcd2 or etcd3 cluster * Multi-node [Torus](Documentation/torus.md) distributed storage cluster * Network boot or Install to Disk * Multi-stage CoreOS installs diff --git a/examples/README.md b/examples/README.md index 39b4a5ab..7c9825e9 100644 --- a/examples/README.md +++ b/examples/README.md @@ -10,6 +10,7 @@ These examples network boot and provision machines into CoreOS clusters using `b | pxe-disk | CoreOS via iPXE, with a root filesystem | alpha/1109.1.0 | Disk | [reference](https://coreos.com/os/docs/latest/booting-with-ipxe.html) | | etcd | iPXE boot a 3 node etcd cluster and proxy | alpha/1109.1.0 | RAM | [reference](https://coreos.com/os/docs/latest/cluster-architectures.html) | | etcd-install | Install a 3-node etcd cluster to disk | alpha/1109.1.0 | Disk | [reference](https://coreos.com/os/docs/latest/installing-to-disk.html) | +| etcd3 | Install a 3-node etcd3 cluster | alpha/1109.1.0 | RAM | None | | k8s | Kubernetes cluster with 1 master, 2 workers, and TLS-authentication | alpha/1109.1.0 | Disk | [tutorial](../Documentation/kubernetes.md) | | k8s-install | Install a Kubernetes cluster to disk | alpha/1109.1.0 | Disk | [tutorial](../Documentation/kubernetes.md) | | rktnetes | Kubernetes cluster with rkt container runtime, 1 master, workers, TLS auth (known bugs, experimental) | alpha/1122.0.0 | Disk | None | diff --git a/examples/groups/etcd/default.json b/examples/groups/etcd/default.json index 11199040..bba738e4 100644 --- a/examples/groups/etcd/default.json +++ b/examples/groups/etcd/default.json @@ -1,7 +1,7 @@ { "id": "default", "name": "default", - "profile": "etcd-proxy", + "profile": "etcd3-proxy", "metadata": { "etcd_initial_cluster": "node1=http://node1.example.com:2380,node2=http://node2.example.com:2380,node3=http://node3.example.com:2380" } diff --git a/examples/groups/etcd3/default.json b/examples/groups/etcd3/default.json new file mode 100644 index 00000000..11199040 --- /dev/null +++ b/examples/groups/etcd3/default.json @@ -0,0 +1,8 @@ +{ + "id": "default", + "name": "default", + "profile": "etcd-proxy", + "metadata": { + "etcd_initial_cluster": "node1=http://node1.example.com:2380,node2=http://node2.example.com:2380,node3=http://node3.example.com:2380" + } +} diff --git a/examples/groups/etcd3/node1.json b/examples/groups/etcd3/node1.json new file mode 100644 index 00000000..a3814d00 --- /dev/null +++ b/examples/groups/etcd3/node1.json @@ -0,0 +1,13 @@ +{ + "id": "node1", + "name": "etcd Node 1", + "profile": "etcd3", + "selector": { + "mac": "52:54:00:a1:9c:ae" + }, + "metadata": { + "domain_name": "node1.example.com", + "etcd_name": "node1", + "etcd_initial_cluster": "node1=http://node1.example.com:2380,node2=http://node2.example.com:2380,node3=http://node3.example.com:2380" + } +} diff --git a/examples/groups/etcd3/node2.json b/examples/groups/etcd3/node2.json new file mode 100644 index 00000000..788d524d --- /dev/null +++ b/examples/groups/etcd3/node2.json @@ -0,0 +1,13 @@ +{ + "id": "node2", + "name": "etcd Node 2", + "profile": "etcd3", + "selector": { + "mac": "52:54:00:b2:2f:86" + }, + "metadata": { + "domain_name": "node2.example.com", + "etcd_name": "node2", + "etcd_initial_cluster": "node1=http://node1.example.com:2380,node2=http://node2.example.com:2380,node3=http://node3.example.com:2380" + } +} diff --git a/examples/groups/etcd3/node3.json b/examples/groups/etcd3/node3.json new file mode 100644 index 00000000..a73c7660 --- /dev/null +++ b/examples/groups/etcd3/node3.json @@ -0,0 +1,13 @@ +{ + "id": "node3", + "name": "etcd Node 3", + "profile": "etcd3", + "selector": { + "mac": "52:54:00:c3:61:77" + }, + "metadata": { + "domain_name": "node3.example.com", + "etcd_name": "node3", + "etcd_initial_cluster": "node1=http://node1.example.com:2380,node2=http://node2.example.com:2380,node3=http://node3.example.com:2380" + } +} diff --git a/examples/ignition/etcd3-proxy.yaml b/examples/ignition/etcd3-proxy.yaml new file mode 100644 index 00000000..3c9c8287 --- /dev/null +++ b/examples/ignition/etcd3-proxy.yaml @@ -0,0 +1,37 @@ +--- +systemd: + units: + - name: etcd3.service + enable: true + contents: | + [Unit] + Description=etcd3 + Conflicts=etcd2.service + [Service] + Environment="RKT_OPTS=--volume=resolv,kind=host,source=/etc/resolv.conf --mount volume=resolv,target=/etc/resolv.conf" + ExecStartPre=/usr/bin/mkdir -p /var/lib/etcd3 + ExecStartPre=/usr/bin/rkt trust --prefix "coreos.com/etcd" --skip-fingerprint-review + ExecStart=/usr/bin/rkt run \ + --net=host \ + --volume data-dir,kind=host,source=/var/lib/etcd3 \ + --mount volume=data-dir,target=/var/lib/etcd3 \ + $RKT_OPTS \ + coreos.com/etcd:v3.0.4 -- \ + -proxy=on \ + -listen-client-urls=http://0.0.0.0:2379 \ + -initial-cluster={{.etcd_initial_cluster}} + Restart=always + RestartSec=0 + LimitNOFILE=40000 + [Install] + WantedBy=multi-user.target + +{{ if index . "ssh_authorized_keys" }} +passwd: + users: + - name: core + ssh_authorized_keys: + {{ range $element := .ssh_authorized_keys }} + - {{$element}} + {{end}} +{{end}} diff --git a/examples/ignition/etcd3.yaml b/examples/ignition/etcd3.yaml new file mode 100644 index 00000000..f729ceb9 --- /dev/null +++ b/examples/ignition/etcd3.yaml @@ -0,0 +1,41 @@ +--- +systemd: + units: + - name: etcd3.service + enable: true + contents: | + [Unit] + Description=etcd3 + Conflicts=etcd2.service + [Service] + Environment="RKT_OPTS=--volume=resolv,kind=host,source=/etc/resolv.conf --mount volume=resolv,target=/etc/resolv.conf" + ExecStartPre=/usr/bin/mkdir -p /var/lib/etcd3 + ExecStartPre=/usr/bin/rkt trust --prefix "coreos.com/etcd" --skip-fingerprint-review + ExecStart=/usr/bin/rkt run \ + --net=host \ + --volume data-dir,kind=host,source=/var/lib/etcd3 \ + --mount volume=data-dir,target=/var/lib/etcd3 \ + $RKT_OPTS \ + coreos.com/etcd:v3.0.4 -- \ + -name={{.etcd_name}} \ + -advertise-client-urls=http://{{.domain_name}}:2379 \ + -initial-advertise-peer-urls=http://{{.domain_name}}:2380 \ + -listen-client-urls=http://0.0.0.0:2379 \ + -listen-peer-urls=http://{{.domain_name}}:2380 \ + -initial-cluster={{.etcd_initial_cluster}} \ + -data-dir=/var/lib/etcd3 + Restart=always + RestartSec=10 + LimitNOFILE=40000 + [Install] + WantedBy=multi-user.target + +{{ if index . "ssh_authorized_keys" }} +passwd: + users: + - name: core + ssh_authorized_keys: + {{ range $element := .ssh_authorized_keys }} + - {{$element}} + {{end}} +{{end}} diff --git a/examples/profiles/etcd3-proxy.json b/examples/profiles/etcd3-proxy.json new file mode 100644 index 00000000..46e5f2c4 --- /dev/null +++ b/examples/profiles/etcd3-proxy.json @@ -0,0 +1,15 @@ +{ + "id": "etcd3-proxy", + "name": "etcd3-proxy", + "boot": { + "kernel": "/assets/coreos/1109.1.0/coreos_production_pxe.vmlinuz", + "initrd": ["/assets/coreos/1109.1.0/coreos_production_pxe_image.cpio.gz"], + "cmdline": { + "coreos.config.url": "http://bootcfg.foo:8080/ignition?uuid=${uuid}&mac=${net0/mac:hexhyp}", + "coreos.autologin": "", + "coreos.first_boot": "" + } + }, + "cloud_id": "", + "ignition_id": "etcd3-proxy.yaml" +} \ No newline at end of file diff --git a/examples/profiles/etcd3.json b/examples/profiles/etcd3.json new file mode 100644 index 00000000..562ef643 --- /dev/null +++ b/examples/profiles/etcd3.json @@ -0,0 +1,15 @@ +{ + "id": "etcd3", + "name": "etcd3", + "boot": { + "kernel": "/assets/coreos/1109.1.0/coreos_production_pxe.vmlinuz", + "initrd": ["/assets/coreos/1109.1.0/coreos_production_pxe_image.cpio.gz"], + "cmdline": { + "coreos.config.url": "http://bootcfg.foo:8080/ignition?uuid=${uuid}&mac=${net0/mac:hexhyp}", + "coreos.autologin": "", + "coreos.first_boot": "" + } + }, + "cloud_id": "", + "ignition_id": "etcd3.yaml" +} \ No newline at end of file