Skip to content

Instantly share code, notes, and snippets.

@dghubble
Last active June 23, 2016 06:39
Show Gist options
  • Save dghubble/5bde8e374cdf445e9c91944f3bbaeea9 to your computer and use it in GitHub Desktop.
Save dghubble/5bde8e374cdf445e9c91944f3bbaeea9 to your computer and use it in GitHub Desktop.

Adding a Node to Self-hosted Kubernetes

Self-hosted Kubernetes clusters provisioned with coreos-baremetal's bootcfg can be expanded by adding new server hardware later if you wish. This can be done by adding (copying) new worker install and provisioning groups which match the new server by MAC address. The same worker profile will be re-used (because templating).

Here's what I did after wiring up my snazzy new (ok old) IBM server to join my existing 3 node Intel NUC cluster.

Requirements

  • Using coreos-baremetal
  • Know the MAC address of the new server's NIC
  • Know the desired static IP or configure your DHCP server to statically assign the IP
  • SSH to where the bootcfg service runs (HTTP/gRPC service which serves configs to all racks/machines)

Usage

Switch to the bootcfg user, which has permission to add a machine group.

sudo su bootcfg
cd /var/lib/boocfg/groups

Copy an existing worker (node2) to create a new worker (node3)

cp install2.json install3.json
cp node2.json node3.json

Edit the group selector MAC address in the install group.

vim install3.json
"selector": {
    "mac": "<new-mac>"
}

Edit the group selector MAC and IP address values in the node group.

vim node3.json
"selector": {
    "mac": "<new-mac>"
    "os": "installed"
}

Change ipv4_address and networkd_address (address/suffix).

"metadata": {
    "ipv4_address": "192.168.1.24",
    ...
    "networkd_address": "192.168.1.24/24"
    ...
}

If you used "skipNetwork": true to delegate networkd configuration to your network, you can skip changing networkd_* metadata values. Currently, you'll still need to update the ipv4_address (we can remove this req. in future).

Power on the machine. It should PXE to CoreOS, install CoreOS, reboot, and provison itself with a kubelet. The on-host kubelet will negotiate with the known Kubernetes controller(s) and register as a Kubernetes worker.

192.168.1.21   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=192.168.1.21,master=true   Ready     5d
192.168.1.22   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=192.168.1.22               Ready     5d
192.168.1.23   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=192.168.1.23               Ready     5d
192.168.1.24   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=192.168.1.24               Ready     25m

This Kubernetes cluster is at v1.3.0-alpha.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment