# Bootstrapping the etcd Cluster Kubernetes components are stateless and store cluster state in [etcd](https://github.com/coreos/etcd). In this lab you will bootstrap a three node etcd cluster and configure it for high availability and secure remote access. ## Prerequisites The commands in this lab must be run on each controller instance: `master-1`, and `master-2`. Login to each of these using an SSH terminal. ### Running commands in parallel with tmux [tmux](https://github.com/tmux/tmux/wiki) can be used to run commands on multiple compute instances at the same time. See the [Running commands in parallel with tmux](01-prerequisites.md#running-commands-in-parallel-with-tmux) section in the Prerequisites lab. ## Bootstrapping an etcd Cluster Member ### Download and Install the etcd Binaries Download the official etcd release binaries from the [coreos/etcd](https://github.com/coreos/etcd) GitHub project: ``` wget -q --show-progress --https-only --timestamping \ "https://github.com/coreos/etcd/releases/download/v3.3.9/etcd-v3.3.9-linux-amd64.tar.gz" ``` Extract and install the `etcd` server and the `etcdctl` command line utility: ``` { tar -xvf etcd-v3.3.9-linux-amd64.tar.gz sudo mv etcd-v3.3.9-linux-amd64/etcd* /usr/local/bin/ } ``` ### Configure the etcd Server ``` { sudo mkdir -p /etc/etcd /var/lib/etcd sudo cp ca.crt etcd-server.key etcd-server.crt /etc/etcd/ } ``` The instance internal IP address will be used to serve client requests and communicate with etcd cluster peers. Retrieve the internal IP address of the master(etcd) nodes: ``` INTERNAL_IP=$(ip addr show enp0s8 | grep "inet " | awk '{print $2}' | cut -d / -f 1) ``` Each etcd member must have a unique name within an etcd cluster. Set the etcd name to match the hostname of the current compute instance: ``` ETCD_NAME=$(hostname -s) ``` Create the `etcd.service` systemd unit file: ``` cat < Remember to run the above commands on each controller node: `master-1`, and `master-2`. ## Verification List the etcd cluster members: ``` sudo ETCDCTL_API=3 etcdctl member list \ --endpoints=https://127.0.0.1:2379 \ --cacert=/etc/etcd/ca.crt \ --cert=/etc/etcd/etcd-server.crt \ --key=/etc/etcd/etcd-server.key ``` > output ``` 45bf9ccad8d8900a, started, master-2, https://192.168.5.12:2380, https://192.168.5.12:2379 54a5796a6803f252, started, master-1, https://192.168.5.11:2380, https://192.168.5.11:2379 ``` Next: [Bootstrapping the Kubernetes Control Plane](08-bootstrapping-kubernetes-controllers.md)