examples: Add Torus cluster on etcd3

This commit is contained in:
Dalton Hubble
2016-06-02 13:13:47 -07:00
parent f561b83647
commit 368ff381fe
8 changed files with 171 additions and 1 deletions

View File

@@ -13,6 +13,7 @@
#### Examples
* Add self-hosted Kubernetes example (PXE boot or install to disk)
* Add CoreOS Torus distributed storage cluster example (PXE boot)
* Add `create-uefi` subcommand to `scripts/libvirt` for UEFI/GRUB testing
* Updated Kubernetes examples to v1.2.4
* Remove 8.8.8.8 from networkd example Ignition configs (#184)

View File

@@ -42,6 +42,7 @@ The [examples](examples) show how to network boot and provision higher-order Cor
* Multi-node [Kubernetes cluster](Documentation/kubernetes.md) with TLS
* Multi-node [self-hosted Kubernetes cluster](Documentation/bootkube.md)
* Multi-node etcd cluster
* Multi-node Torus distributed storage cluster
* Network boot or Install to Disk
* Multi-stage CoreOS installs
* [GRUB Netboot](Documentation/grub.md) CoreOS

View File

@@ -1,7 +1,7 @@
# Examples
These examples network boot and provision VMs into CoreOS clusters using `bootcfg`.
These examples network boot and provision machines into CoreOS clusters using `bootcfg`. You can re-use their profiles to provision your own physical machines.
| Name | Description | CoreOS Version | FS | Docs |
|------------|-------------|----------------|----|-----------|
@@ -14,6 +14,7 @@ These examples network boot and provision VMs into CoreOS clusters using `bootcf
| k8s-install | Install a Kubernetes cluster to disk (1 master) | alpha/1053.2.0 | Disk | [tutorial](../Documentation/kubernetes.md) |
| bootkube | iPXE boot a self-hosted Kubernetes cluster (with bootkube) | alpha/1053.2.0 | Disk | [tutorial](../Documentation/bootkube.md) |
| bootkube-install | Install a self-hosted Kubernetes cluster (with bootkube) | alpha/1053.2.0 | Disk | [tutorial](../Documentation/bootkube.md) |
| torus | CoreOS Torus distributed storage | alpha/1053.2.0 | Disk | [reference](https://github.com/coreos/torus) |
## Tutorials

View File

@@ -0,0 +1,18 @@
{
"id": "node1",
"name": "Torus Node 1",
"profile": "torus",
"selector": {
"mac": "52:54:00:a1:9c:ae"
},
"metadata": {
"etcd_initial_cluster": "node1=http://172.15.0.21:2380,node2=http://172.15.0.22:2380,node3=http://172.15.0.23:2380",
"etcd_name": "node1",
"ipv4_address": "172.15.0.21",
"networkd_address": "172.15.0.21/16",
"networkd_dns": "172.15.0.3",
"networkd_gateway": "172.15.0.1",
"pxe": "true",
"torus_storage_size": "1GiB"
}
}

View File

@@ -0,0 +1,18 @@
{
"id": "node2",
"name": "Torus Node 2",
"profile": "torus",
"selector": {
"mac": "52:54:00:b2:2f:86"
},
"metadata": {
"etcd_initial_cluster": "node1=http://172.15.0.21:2380,node2=http://172.15.0.22:2380,node3=http://172.15.0.23:2380",
"etcd_name": "node2",
"ipv4_address": "172.15.0.22",
"networkd_address": "172.15.0.22/16",
"networkd_dns": "172.15.0.3",
"networkd_gateway": "172.15.0.1",
"pxe": "true",
"torus_storage_size": "1GiB"
}
}

View File

@@ -0,0 +1,18 @@
{
"id": "node3",
"name": "Torus Node 3",
"profile": "torus",
"selector": {
"mac": "52:54:00:c3:61:77"
},
"metadata": {
"etcd_initial_cluster": "node1=http://172.15.0.21:2380,node2=http://172.15.0.22:2380,node3=http://172.15.0.23:2380",
"etcd_name": "node3",
"ipv4_address": "172.15.0.23",
"networkd_address": "172.15.0.23/16",
"networkd_dns": "172.15.0.3",
"networkd_gateway": "172.15.0.1",
"pxe": "true",
"torus_storage_size": "1GiB"
}
}

View File

@@ -0,0 +1,97 @@
---
ignition_version: 1
systemd:
units:
- name: etcd3.service
enable: true
contents: |
[Unit]
Description=etcd3
Conflicts=etcd2.service
After=docker.service
Requires=docker.service
[Service]
ExecStartPre=/usr/bin/mkdir -p /var/lib/etcd3
ExecStart=/usr/bin/docker run \
--net=host \
-e ETCD_NAME={{.etcd_name}} \
-e ETCD_ADVERTISE_CLIENT_URLS=http://{{.ipv4_address}}:2379 \
-e ETCD_INITIAL_ADVERTISE_PEER_URLS=http://{{.ipv4_address}}:2380 \
-e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \
-e ETCD_LISTEN_PEER_URLS=http://{{.ipv4_address}}:2380 \
-e ETCD_INITIAL_CLUSTER={{.etcd_initial_cluster}} \
-e ETCD_DATA_DIR=/var/lib/etcd3 \
quay.io/coreos/etcd:v3.0.0-beta.0
Restart=always
RestartSec=10
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target
- name: torus.service
enable: true
contents: |
[Unit]
Description=CoreOS Torus
Requires=etcd3.service
After=etcd3.service
Requires=docker.service
After=docker.service
[Service]
ExecStartPre=/usr/bin/mkdir -p /srv/torus
ExecStart=/usr/bin/docker run \
--net=host \
-v /srv/torus:/data \
-e STORAGE_SIZE={{.torus_storage_size}} \
-e LISTEN_HOST={{.ipv4_address}} \
-e ETCD_HOST=127.0.0.1 \
-e ETCD_PORT=2379 \
-e AUTO_JOIN=1 \
-e DEBUG_INIT=1 \
quay.io/coreos/torus
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
storage:
{{ if index . "pxe" }}
disks:
- device: /dev/sda
wipe_table: true
partitions:
- label: ROOT
filesystems:
- device: "/dev/sda1"
format: "ext4"
create:
force: true
options:
- "-LROOT"
{{else}}
filesystems:
- device: "/dev/disk/by-label/ROOT"
format: "ext4"
{{end}}
{{ if not (index . "skip_networkd") }}
networkd:
units:
- name: 10-static.network
contents: |
[Match]
MACAddress={{.mac}}
[Network]
Gateway={{.networkd_gateway}}
DNS={{.networkd_dns}}
Address={{.networkd_address}}
{{end}}
{{ 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,16 @@
{
"id": "torus",
"name": "torus",
"boot": {
"kernel": "/assets/coreos/1053.2.0/coreos_production_pxe.vmlinuz",
"initrd": ["/assets/coreos/1053.2.0/coreos_production_pxe_image.cpio.gz"],
"cmdline": {
"root": "/dev/sda1",
"coreos.config.url": "http://bootcfg.foo:8080/ignition?uuid=${uuid}&mac=${net0/mac:hexhyp}",
"coreos.autologin": "",
"coreos.first_boot": ""
}
},
"cloud_id": "",
"ignition_id": "torus.yaml"
}