Skip to content

Latest commit

 

History

History
199 lines (154 loc) · 5.08 KB

getting_started.md

File metadata and controls

199 lines (154 loc) · 5.08 KB

Getting started

This document quickly guides you to configure sabakan and netboot your servers with Flatcar Container Linux.

Sabakan requires etcd. Install and run it at localhost.

You may use docker to run etcd as follows:

$ docker pull gcr.io/etcd-development/etcd:v3.5.3
$ docker run -d --rm --name etcd --network=host --uts=host gcr.io/etcd-development/etcd:v3.5.3
$ sudo mkdir -p /var/lib/sabakan

Create self-signed server certificate by using script and put it to /etc/sabakan:

$ sudo mkdir -p /etc/sabakan
$ git clone github.com/cybozu-go/sabakan
$ make setup-cfssl
$ cd e2e/certs && ./gencerts.sh
$ cd ../..
$ sudo cp e2e/output/certs/server.crt /etc/sabakan/server.crt
$ sudo cp e2e/output/certs/server.key.insecure /etc/sabakan/server.key

Save the following contents as /usr/local/etc/sabakan.yml:

advertise-url: http://localhost:10080
advertise-url-https: https://localhost:10443
etcd:
  endpoints:
    - http://localhost:2379
dhcp-bind: 0.0.0.0:67

For other options, read sabakan.md.

Compile and run sabakan as follows:

$ GOPATH=$HOME/go
$ mkdir -p $GOPATH/src
$ export GOPATH
$ go get -u github.com/cybozu-go/sabakan/...
$ sudo $GOPATH/bin/sabakan -config-file /usr/local/etc/sabakan.yml

A sample systemd service file is available at pkg/sabakan/sabakan.service.

Alternatively, you may use docker to run sabakan:

Prepare ipam.json as follows:

{
   "max-nodes-in-rack": 28,
   "node-ipv4-pool": "10.69.0.0/20",
   "node-ipv4-range-size": 6,
   "node-ipv4-range-mask": 26,
   "node-ip-per-node": 3,
   "node-index-offset": 3,
   "node-gateway-offset": 1,
   "bmc-ipv4-pool": "10.72.16.0/20",
   "bmc-ipv4-offset": "0.0.1.0",
   "bmc-ipv4-range-size": 5,
   "bmc-ipv4-range-mask": 20,
   "bmc-ipv4-gateway-offset": 1
}

Then put the JSON to sabakan:

$ sabactl ipam set -f ipam.json

Read ipam.md for details.

If you want to customize DHCP options as described in dhcp.md,

  1. Prepare dhcp.json as follows:

    {
        "dns-servers": ["8.8.8.8", "1.1.1.1"]
    }
  2. Put the JSON to sabakan:

    $ sabactl dhcp set -f dhcp.json

Download Flatcar PXE boot images:

$ curl -o kernel -Lf http://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_pxe.vmlinuz
$ curl -o initrd.gz -Lf http://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_pxe_image.cpio.gz

Upload them to sabakan as follows:

$ sabactl images upload ID kernel initrd.gz

Prepare machines.json as follows:

[
  {
    "serial": "1234abcd",
    "labels": {
      "product": "R640",
      "datacenter": "tokyo1"
    },
    "rack": 0,
    "role": "boot",
    "bmc": {
      "type": "IPMI-2.0"
    }
  },
  {
    // another machine
  }
]

Then put the JSON to sabakan:

$ sabactl machines create -f machines.json

The input format for this command is described in docs/sabactl.md. Note that the input format is restricted compared to MachineSpec. Sabakan identifies physical servers by serial.

Once machines are properly registered with sabakan, they can netboot Flatcar Container Linux using UEFI HTTP Boot.

Flatcar can be initialized at first boot by ignition. Sabakan can generate ignition configuration from templates. Read ignition_template.md for details.

Put the kernel parameters to sabakan:

$ sabactl kernel-params set "console=ttyS0 coreos.autologin=ttyS0"

When iPXE script is acquired, this value is passed as the kernel parameter of iPXE script.

Learn sabakan concepts, then read other specifications.