How to do it...

There are plenty of ways to provision an etcd cluster. Normally, you'll use kubespray, kops (in AWS), or other provisioning tools.

Here, we'll simply show you how to perform a manual install. It's fairly easy as well:

// etcd installation script
$ cat install-etcd.sh
ETCD_VER=v3.3.0

# ${DOWNLOAD_URL} could be ${GOOGLE_URL} or ${GITHUB_URL}
GOOGLE_URL=https://storage.googleapis.com/etcd
GITHUB_URL=https://github.com/coreos/etcd/releases/download
DOWNLOAD_URL=${GOOGLE_URL}

# delete tmp files
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
rm -rf /tmp/etcd && rm -rf /etc/etcd && mkdir -p /etc/etcd

curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /etc/etcd --strip-components=1
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz

# check etcd version
/etc/etcd/etcd --version

This script will put etcd binary under /etc/etcd folder. You're free to put them in different place. We'll need sudo in order to put them under /etc in this case:

// install etcd on linux
# sudo sh install-etcd.sh

etcd Version: 3.3.0
Git SHA: c23606781
Go Version: go1.9.3
Go OS/Arch: linux/amd64

The version we're using now is 3.3.0. After we check the etcd binary work on your machine, we can attach it to the default $PATH as follows. Then we don't need to include the/etc/etcd path every time we execute the etcd command:

$ export PATH=/etc/etcd:$PATH
$ export ETCDCTL_API=3

You also can put it into your .bashrc or .bash_profile to let it set by default.

After we have at least three etcd servers provisioned, it's time to make them pair together.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset