Merge pull request #315 from coreos/etcd3

Add etcd3 example cluster with rkt
This commit is contained in:
Dalton Hubble
2016-08-16 11:49:50 -07:00
committed by GitHub
11 changed files with 158 additions and 2 deletions

View File

@@ -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

View File

@@ -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 |

View File

@@ -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"
}

View File

@@ -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"
}
}

View File

@@ -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"
}
}

View File

@@ -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"
}
}

View File

@@ -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"
}
}

View File

@@ -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}}

View File

@@ -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}}

View File

@@ -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"
}

View File

@@ -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"
}