From 5342e28754b10e5b7de240e5190c8722c5bb9ac9 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Sun, 21 Aug 2016 17:06:59 -0700 Subject: [PATCH] examples: Run Torus' etcd3 with rkt * Bump etcd3 version to 3.0.6 --- Documentation/torus.md | 8 +++++--- examples/README.md | 2 +- examples/ignition/torus.yaml | 27 ++++++++++++++++----------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Documentation/torus.md b/Documentation/torus.md index 71a8efb8..486d09b2 100644 --- a/Documentation/torus.md +++ b/Documentation/torus.md @@ -16,7 +16,7 @@ Ensure that you've gone through the [bootcfg with rkt](getting-started-rkt.md) g The [examples](../examples) statically assign IP addresses to libvirt client VMs created by `scripts/libvirt`. The examples can be used for physical machines if you update the MAC/IP addresses. See [network setup](network-setup.md) and [deployment](deployment.md). -* [torus](../examples/groups/torus) - iPXE boot a Torus cluster (use rkt) +* [torus](../examples/groups/torus) - iPXE boot a Torus cluster ## Assets @@ -30,7 +30,7 @@ Run the latest `bootcfg` ACI with rkt and the `torus` example. sudo rkt run --net=metal0:IP=172.15.0.2 --mount volume=data,target=/var/lib/bootcfg --volume data,kind=host,source=$PWD/examples --mount volume=groups,target=/var/lib/bootcfg/groups --volume groups,kind=host,source=$PWD/examples/groups/torus quay.io/coreos/bootcfg:latest -- -address=0.0.0.0:8080 -log-level=debug -Create a network boot environment and power-on your machines. Revisit [bootcfg with rkt](getting-started-rkt.md) for help. Client machines should network boot and provision themselves. +Create a network boot environment and power-on your machines. Revisit [bootcfg with rkt](getting-started-rkt.md) or [bootcfg with Docker](getting-started-docker.md) for help. Client machines should network boot and provision themselves. ## Verify @@ -57,7 +57,7 @@ Torus has already initialized its metadata within etcd3 to format the cluster an Create a new replicated, virtual block device or `volume` on Torus. - ./torusctl block create --etcd=172.15.0.21:2379 hello 500MiB + ./torusctl --etcd=172.15.0.21:2379 block create hello 500MiB List the current volumes, @@ -91,6 +91,8 @@ Check that the mounted filesystem is present. $ mount | grep nbd /dev/nbd0 on /mnt/hello type ext4 (rw,noatime,seclabel,discard,data=ordered) +### Simulate Failure + By default, Torus uses a replication factor of 2. You may write some data and poweroff one of the three nodes if you wish. sudo sh -c "echo 'hello world' > /mnt/hello/world" diff --git a/examples/README.md b/examples/README.md index c21b7fb1..a96c5e02 100644 --- a/examples/README.md +++ b/examples/README.md @@ -28,7 +28,7 @@ Get started running `bootcfg` on your Linux machine to network boot and provisio * [bootcfg with Docker](../Documentation/getting-started-docker.md) * [Kubernetes (static manifests)](../Documentation/kubernetes.md) * [Kubernetes (self-hosted)](../Documentation/bootkube.md) -* [Torus Storage](..Documentation/torus.md) +* [Torus Storage](../Documentation/torus.md) * [Lab Examples](https://github.com/dghubble/metal) ## SSH Keys diff --git a/examples/ignition/torus.yaml b/examples/ignition/torus.yaml index fd59d659..e19cd83c 100644 --- a/examples/ignition/torus.yaml +++ b/examples/ignition/torus.yaml @@ -7,22 +7,27 @@ systemd: [Unit] Description=etcd3 Conflicts=etcd2.service - After=docker.service - Requires=docker.service [Service] + Type=notify + 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 - ExecStart=/usr/bin/docker run \ + ExecStartPre=/usr/bin/rkt trust --prefix "coreos.com/etcd" --skip-fingerprint-review + ExecStart=/usr/bin/rkt run \ --net=host \ - -e ETCD_NAME={{.etcd_name}} \ - -e ETCD_ADVERTISE_CLIENT_URLS=http://{{.domain_name}}:2379 \ - -e ETCD_INITIAL_ADVERTISE_PEER_URLS=http://{{.domain_name}}:2380 \ - -e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \ - -e ETCD_LISTEN_PEER_URLS=http://{{.domain_name}}:2380 \ - -e ETCD_INITIAL_CLUSTER={{.etcd_initial_cluster}} \ - -e ETCD_DATA_DIR=/var/lib/etcd3 \ - quay.io/coreos/etcd:v3.0.1 + --volume data-dir,kind=host,source=/var/lib/etcd3 \ + --mount volume=data-dir,target=/var/lib/etcd3 \ + $RKT_OPTS \ + coreos.com/etcd:v3.0.6 -- \ + -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 TimeoutStartSec=0 [Install] WantedBy=multi-user.target