User talk:Jch/consul

From Alpine Linux

Consul

Introduction

This page is currently my experimental log about consul on AL.

Downloaded package: consul-0.5.0-r0.apk from http://repos.mauras.ch/alpinelinux/x86_64/

Will prepare 5 KVM: 3 consul server (in run-from-ram mode) and 2 consul agent (a SAN (NBD) and a LXC host in data mode) on an isolated network.

We will experiment to find the right spec to allocate the consul servers for 100 to 1000 agents.

We plan to orchestrate our VM fleet based on consul events, envconsul and consul-template. All with ash scripts and smart setup.

We combine our PXE servers and the consul ones to inherit from the consul resilence (consul leader) to offer high-availability (HA) (but still in ram only) to the PXE service.

Install

As we start from scratch and want to have an isolated network to run our tests, this topic is also an introduction to our new architecture for the cluster (the cloud).

The 5 machines defined to start our tests will be designed as a virtual cluster and bootstraped as it was a real cluster...
from a virtual laptop booting from a virtual USB stick.
This first "machine zero" to bootstrap the first PXE server, then to start 2nd and 3rd PXEservers.
Then to start a SAN.
Then to start a KVM-repo.
Then to reboot all KVM-PXE or at least adapt there config to use new repo.
Then to start a LXC host.
(then to start services and other KVM)

We will just focus on the consul installation and configuration parts.

wget http://repos.mauras.ch/alpinelinux/x86_64/consul-0.5.0-r0.apk
apk add consul-0.5.0-r0.apk --allow-untrusted --force

Configuration

Configuration Server

We make the choice to have the servers running from ram...

The consul part will take care for herself.

For the apkovl files rsync must be used between active server and passive ones.
The best should be to be triggered by an update of the apkovl directory.

The dhcpd states are also kept in relative sync between active and passive dhcpd servers (the same ones).

Bur here, we are interested to the consul stuff...

Configuration Agent

We need to lauch the consul service after being able to read the IP address of the PXEserver involved.
This particuliar address will be used to join the consul cluster as agent.

# read IP addr of PXEserver
# consul agent -join ${IP_PXEserver}

Consul leader

It checks that all other PXE servers are inactive and that herself is active as dhcpd..

Usage

Machines discovery

List machines = list members

list PXEservers = list servers

whois active.PXEservers = get leader

Services discoevry

Register service

List services

Cheks

Key/Value storage

k/v

Events

Define event

Watch event

Triggers