Introduction to ETCD

Using ectdctl to create a simple key-value store

Joe Cardillo
2 min readJan 30, 2022


Keys laying on a table, all facing the same direction
Photo by Alp Duran on Unsplash

What is ETCD?

The technical definition is: “etcd is a consistent and highly-available key value store used as Kubernetes’ backing store for all cluster data.” What does that mean, though? Let’s see if we can take a look under the hood and start with the basics.

What is a key-value store?

We most often see databases in tabular format. Which, in other words, is just data stored in rows and columns. For example, you might have a column for “Name”, and second for “Age”, a third for “Favorite food”, and so on.

A key-value store is a bit different in that you cannot have duplicate keys. In other words, there can only be one key called “Name”. Each key has an associated value.

Key: Name
Value: John

Key: Age
Value: 34

Key: Favorite-food
Value: Ice cream

This is useful for storing small chunks of data that require fast read/write.

Installing and running etcd

To test out using etcd as a key-value store on your own, install it locally on a Linux machine. At the time of writing, v3.5.1 is the latest.

I used these commands to install it on a vanilla Debian server.

curl -L -o etcd-v3.5.1-linux-amd64.tar.gz tar xzvf etcd-v3.5.1-linux-amd64.tar.gz rm etcd-v3.5.1-linux-amd64.tar.gz

Export etcd-v3.5.1-linux-amd64 to your PATH.

export PATH=$PATH:/path/to/etcd-v3.5.1-linux-amd64

Run etcd to start it. This will run a service that listens or port 2379, which the ss command shows:

$ ss -plunt | grep :2379 
tcp LISTEN 0 128 *:* users:(("etcd",pid=2394,fd=8))

In a new screen session (or with tmux), you can create a key-value store using etcdctl. (Note: You’ll need to export your PATH again in the new terminal window/screen/pane, unless you added it permanently to your PATH in your bash profile.)

Now you can create a key-value store using etcdctl.

$ etcdctl put name joe 

To view the value associated with this key (name), run:

$ etcdctl get name 



Joe Cardillo

Technical Support Engineer at Linode | Linux & Kubernetes