DEV Community

Cover image for [Lab Notes] Kubernetes the Hard Way, For Real This Time (Step 07)
Luger Lex Pit-og
Luger Lex Pit-og

Posted on

[Lab Notes] Kubernetes the Hard Way, For Real This Time (Step 07)

Continuing my Kubernetes the Hard Way homelab build. Steps 01-06 are already done, this covers step 07.

Original guide: 07-bootstrapping-etcd.md

Thoughts I had while doing this

This step sets up the etcd cluster. From what I understand, etcd is basically Kubernetes' database, it's where the "state" of the whole cluster gets stored.

Quick TLDR before the actual steps:

  1. grab the etcd binaries/service file
  2. copy them over to the controller/server node
  3. then install and configure etcd as a systemd service
  4. End result: a running etcd Linux service on the controller.

So I basically just installed a database for Kubernetes.

Prerequisites

root@luger-VirtualBox:~/kubernetes-the-hard-way# scp \
  downloads/controller/etcd \
  downloads/client/etcdctl \
  units/etcd.service \
  root@server:~/
etcd        100%   24MB  92.2MB/s   00:00
etcdctl     100%   16MB 130.8MB/s   00:00
etcd.service
Enter fullscreen mode Exit fullscreen mode

Install the etcd binaries

root@server:~# {
  mv etcd etcdctl /usr/local/bin/
}
Enter fullscreen mode Exit fullscreen mode

Configure the etcd server

root@server:~# {
  mkdir -p /etc/etcd /var/lib/etcd
  chmod 700 /var/lib/etcd
  cp ca.crt kube-api-server.key kube-api-server.crt \
    /etc/etcd/
}
root@server:~# mv etcd.service /etc/systemd/system/
Enter fullscreen mode Exit fullscreen mode

Start the etcd server

root@server:~# {
  systemctl daemon-reload
  systemctl enable etcd
  systemctl start etcd
}
Created symlink /etc/systemd/system/multi-user.target.wants/etcd.service → /etc/systemd/system/etcd.service.
Enter fullscreen mode Exit fullscreen mode

Verification

root@server:~# etcdctl member list
6702b0a34e2cfd39, started, controller, http://127.0.0.1:2380, http://127.0.0.1:2379, false
Enter fullscreen mode Exit fullscreen mode

etcd is up, and member list confirms it's running as a single-member cluster named controller.

Summary

Got etcd installed and running as a systemd service on the controller node, using the CA and API server certs from step 04 to secure it. Followed the guide as-is, no deviations this time.

Top comments (0)