mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 10:19:35 +00:00
examples: Update etcd3 (etcd-member) and use the etcd3 gateway
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
# Getting Started with Docker
|
||||
|
||||
In this tutorial, we'll run `matchbox` on your Linux machine with Docker to network boot and provision a cluster of QEMU/KVM CoreOS machines locally. You'll be able to create Kubernetes clusters, etcd clusters, and test network setups.
|
||||
In this tutorial, we'll run `matchbox` on your Linux machine with Docker to network boot and provision a cluster of QEMU/KVM CoreOS machines locally. You'll be able to create Kubernetes clusters, etcd3 clusters, and test network setups.
|
||||
|
||||
*Note*: To provision physical machines, see [network setup](network-setup.md) and [deployment](deployment.md).
|
||||
|
||||
@@ -39,9 +39,9 @@ For development convenience, add `/etc/hosts` entries for nodes so they may be r
|
||||
Run the latest `matchbox` Docker image from `quay.io/coreos/matchbox` with the `etcd-docker` example. The container should receive the IP address 172.17.0.2 on the `docker0` bridge.
|
||||
|
||||
sudo docker pull quay.io/coreos/matchbox:latest
|
||||
sudo docker run -p 8080:8080 --rm -v $PWD/examples:/var/lib/matchbox:Z -v $PWD/examples/groups/etcd:/var/lib/matchbox/groups:Z quay.io/coreos/matchbox:latest -address=0.0.0.0:8080 -log-level=debug
|
||||
sudo docker run -p 8080:8080 --rm -v $PWD/examples:/var/lib/matchbox:Z -v $PWD/examples/groups/etcd3:/var/lib/matchbox/groups:Z quay.io/coreos/matchbox:latest -address=0.0.0.0:8080 -log-level=debug
|
||||
|
||||
Take a look at the [etcd groups](../examples/groups/etcd) to get an idea of how machines are mapped to Profiles. Explore some endpoints exposed by the service, say for QEMU/KVM node1.
|
||||
Take a look at the [etcd3 groups](../examples/groups/etcd3) to get an idea of how machines are mapped to Profiles. Explore some endpoints exposed by the service, say for QEMU/KVM node1.
|
||||
|
||||
* iPXE [http://127.0.0.1:8080/ipxe?mac=52:54:00:a1:9c:ae](http://127.0.0.1:8080/ipxe?mac=52:54:00:a1:9c:ae)
|
||||
* Ignition [http://127.0.0.1:8080/ignition?mac=52:54:00:a1:9c:ae](http://127.0.0.1:8080/ignition?mac=52:54:00:a1:9c:ae)
|
||||
@@ -75,11 +75,12 @@ Use the wrapper script to act on all nodes.
|
||||
|
||||
## Verify
|
||||
|
||||
The VMs should network boot and provision themselves into a three node etcd cluster, with other nodes behaving as etcd proxies.
|
||||
The VMs should network boot and provision themselves into a three node etcd3 cluster, with other nodes behaving as etcd3 gateways.
|
||||
|
||||
The example profile added autologin so you can verify that etcd works between nodes.
|
||||
The example profile added autologin so you can verify that etcd3 works between nodes.
|
||||
|
||||
systemctl status etcd2
|
||||
systemctl status etcd-member
|
||||
ETCDCTL_API=3
|
||||
etcdctl set /message hello
|
||||
etcdctl get /message
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
# Getting Started with rkt
|
||||
|
||||
In this tutorial, we'll run `matchbox` on your Linux machine with `rkt` and `CNI` to network boot and provision a cluster of QEMU/KVM CoreOS machines locally. You'll be able to create Kubernetes clustes, etcd clusters, and test network setups.
|
||||
In this tutorial, we'll run `matchbox` on your Linux machine with `rkt` and `CNI` to network boot and provision a cluster of QEMU/KVM CoreOS machines locally. You'll be able to create Kubernetes clustes, etcd3 clusters, and test network setups.
|
||||
|
||||
*Note*: To provision physical machines, see [network setup](network-setup.md) and [deployment](deployment.md).
|
||||
|
||||
@@ -76,7 +76,7 @@ Trust the needed ACIs.
|
||||
|
||||
The `devnet` wrapper script can quickly rkt run `matchbox` and `dnsmasq` in systemd transient units. Create can take the name of any example cluster in [examples](../examples).
|
||||
|
||||
sudo ./scripts/devnet create etcd
|
||||
sudo ./scripts/devnet create etcd3
|
||||
|
||||
Inspect the journal logs or check the status of the systemd services.
|
||||
|
||||
@@ -86,7 +86,7 @@ Inspect the journal logs or check the status of the systemd services.
|
||||
journalctl -f -u dev-matchbox
|
||||
journalctl -f -u dev-dnsmasq
|
||||
|
||||
Take a look at the [etcd groups](../examples/groups/etcd) to get an idea of how machines are mapped to Profiles. Explore some endpoints exposed by the service, say for QEMU/KVM node1.
|
||||
Take a look at the [etcd3 groups](../examples/groups/etcd3) to get an idea of how machines are mapped to Profiles. Explore some endpoints exposed by the service, say for QEMU/KVM node1.
|
||||
|
||||
* iPXE [http://172.18.0.2:8080/ipxe?mac=52:54:00:a1:9c:ae](http://172.18.0.2:8080/ipxe?mac=52:54:00:a1:9c:ae)
|
||||
* Ignition [http://172.18.0.2:8080/ignition?mac=52:54:00:a1:9c:ae](http://172.18.0.2:8080/ignition?mac=52:54:00:a1:9c:ae)
|
||||
@@ -96,8 +96,8 @@ Take a look at the [etcd groups](../examples/groups/etcd) to get an idea of how
|
||||
|
||||
If you prefer to start the containers yourself, instead of using `devnet`:
|
||||
|
||||
# matchbox with etcd example
|
||||
sudo rkt run --net=metal0:IP=172.18.0.2 --mount volume=data,target=/var/lib/matchbox --volume data,kind=host,source=$PWD/examples --mount volume=groups,target=/var/lib/matchbox/groups --volume groups,kind=host,source=$PWD/examples/groups/etcd quay.io/coreos/matchbox:latest -- -address=0.0.0.0:8080 -log-level=debug
|
||||
# matchbox with etcd3 example
|
||||
sudo rkt run --net=metal0:IP=172.18.0.2 --mount volume=data,target=/var/lib/matchbox --volume data,kind=host,source=$PWD/examples --mount volume=groups,target=/var/lib/matchbox/groups --volume groups,kind=host,source=$PWD/examples/groups/etcd3 quay.io/coreos/matchbox:latest -- -address=0.0.0.0:8080 -log-level=debug
|
||||
# dnsmasq
|
||||
sudo rkt run coreos.com/dnsmasq:v0.3.0 --net=metal0:IP=172.18.0.3 --mount volume=config,target=/etc/dnsmasq.conf --volume config,kind=host,source=$PWD/contrib/dnsmasq/metal0.conf
|
||||
|
||||
@@ -125,11 +125,12 @@ Use the wrapper script to act on all nodes.
|
||||
|
||||
## Verify
|
||||
|
||||
The VMs should network boot and provision themselves into a three node etcd cluster, with other nodes behaving as etcd proxies.
|
||||
The VMs should network boot and provision themselves into a three node etcd3 cluster, with other nodes behaving as etcd3 gateways.
|
||||
|
||||
The example profile added autologin so you can verify that etcd works between nodes.
|
||||
The example profile added autologin so you can verify that etcd3 works between nodes.
|
||||
|
||||
systemctl status etcd2
|
||||
systemctl status etcd-member
|
||||
ETCDCTL_API=3
|
||||
etcdctl set /message hello
|
||||
etcdctl get /message
|
||||
|
||||
|
||||
11
examples/groups/etcd3-install/gateway.json
Normal file
11
examples/groups/etcd3-install/gateway.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "default",
|
||||
"name": "default",
|
||||
"profile": "etcd3-gateway",
|
||||
"selector": {
|
||||
"os": "installed"
|
||||
},
|
||||
"metadata": {
|
||||
"etcd_endpoints": "node1.example.com:2379,node2.example.com:2379,node3.example.com:2379"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"id": "default",
|
||||
"name": "default",
|
||||
"profile": "etcd3-proxy",
|
||||
"selector": {
|
||||
"os": "installed"
|
||||
},
|
||||
"metadata": {
|
||||
"etcd_initial_cluster": "node1=http://node1.example.com:2380,node2=http://node2.example.com:2380,node3=http://node3.example.com:2380"
|
||||
}
|
||||
}
|
||||
8
examples/groups/etcd3/gateway.json
Normal file
8
examples/groups/etcd3/gateway.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "default",
|
||||
"name": "default",
|
||||
"profile": "etcd3-gateway",
|
||||
"metadata": {
|
||||
"etcd_endpoints": "node1.example.com:2379,node2.example.com:2379,node3.example.com:2379"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"id": "default",
|
||||
"name": "default",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
31
examples/ignition/etcd3-gateway.yaml
Normal file
31
examples/ignition/etcd3-gateway.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
systemd:
|
||||
units:
|
||||
- name: etcd-member.service
|
||||
enable: true
|
||||
dropins:
|
||||
- name: 40-etcd-cluster.conf
|
||||
contents: |
|
||||
[Service]
|
||||
Environment="ETCD_IMAGE_TAG=v3.1.0"
|
||||
ExecStart=
|
||||
ExecStart=/usr/lib/coreos/etcd-wrapper gateway start \
|
||||
--listen-addr=127.0.0.1:2379 \
|
||||
--endpoints={{.etcd_endpoints}}
|
||||
- name: locksmithd.service
|
||||
dropins:
|
||||
- name: 40-etcd-lock.conf
|
||||
contents: |
|
||||
[Service]
|
||||
Environment="REBOOT_STRATEGY=etcd-lock"
|
||||
|
||||
{{ if index . "ssh_authorized_keys" }}
|
||||
passwd:
|
||||
users:
|
||||
- name: core
|
||||
ssh_authorized_keys:
|
||||
{{ range $element := .ssh_authorized_keys }}
|
||||
- {{$element}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
---
|
||||
systemd:
|
||||
units:
|
||||
- name: etcd3.service
|
||||
enable: true
|
||||
contents: |
|
||||
[Unit]
|
||||
Description=etcd3
|
||||
Conflicts=etcd2.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
|
||||
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.6 -- \
|
||||
-proxy=on \
|
||||
-listen-client-urls=http://0.0.0.0:2379 \
|
||||
-initial-cluster={{.etcd_initial_cluster}}
|
||||
Restart=always
|
||||
RestartSec=0
|
||||
LimitNOFILE=40000
|
||||
TimeoutStartSec=0
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
- name: locksmithd.service
|
||||
dropins:
|
||||
- name: 40-etcd-lock.conf
|
||||
contents: |
|
||||
[Service]
|
||||
Environment="REBOOT_STRATEGY=etcd-lock"
|
||||
|
||||
{{ if index . "ssh_authorized_keys" }}
|
||||
passwd:
|
||||
users:
|
||||
- name: core
|
||||
ssh_authorized_keys:
|
||||
{{ range $element := .ssh_authorized_keys }}
|
||||
- {{$element}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
@@ -1,36 +1,20 @@
|
||||
---
|
||||
systemd:
|
||||
units:
|
||||
- name: etcd3.service
|
||||
- name: etcd-member.service
|
||||
enable: true
|
||||
contents: |
|
||||
[Unit]
|
||||
Type=notify
|
||||
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.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://0.0.0.0:2380 \
|
||||
-initial-cluster={{.etcd_initial_cluster}} \
|
||||
-data-dir=/var/lib/etcd3
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
LimitNOFILE=40000
|
||||
TimeoutStartSec=0
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
dropins:
|
||||
- name: 40-etcd-cluster.conf
|
||||
contents: |
|
||||
[Service]
|
||||
Environment="ETCD_IMAGE_TAG=v3.1.0"
|
||||
Environment="ETCD_NAME={{.etcd_name}}"
|
||||
Environment="ETCD_ADVERTISE_CLIENT_URLS=http://{{.domain_name}}:2379"
|
||||
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=http://{{.domain_name}}:2380"
|
||||
Environment="ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379"
|
||||
Environment="ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380"
|
||||
Environment="ETCD_INITIAL_CLUSTER={{.etcd_initial_cluster}}"
|
||||
Environment="ETCD_STRICT_RECONFIG_CHECK=true"
|
||||
- name: locksmithd.service
|
||||
dropins:
|
||||
- name: 40-etcd-lock.conf
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "etcd3-proxy",
|
||||
"name": "etcd3-proxy",
|
||||
"id": "etcd3-gateway",
|
||||
"name": "etcd3-gateway",
|
||||
"boot": {
|
||||
"kernel": "/assets/coreos/1235.9.0/coreos_production_pxe.vmlinuz",
|
||||
"initrd": ["/assets/coreos/1235.9.0/coreos_production_pxe_image.cpio.gz"],
|
||||
@@ -12,5 +12,5 @@
|
||||
"coreos.autologin"
|
||||
]
|
||||
},
|
||||
"ignition_id": "etcd3-proxy.yaml"
|
||||
}
|
||||
"ignition_id": "etcd3-gateway.yaml"
|
||||
}
|
||||
Reference in New Issue
Block a user