Digging Into etcdOSS:kubernetes::fire:
December 1st, 2019
NOTE: You've discovered a draft post! This entry is still under construction 🚧 and shouldn't be listed anywhere ... 🤔
What Is etcd?
etcd per the official site is:
A distributed, reliable key-value store for the most critical data of a distributed system
etcd is a play on
/etc and the long history of nameing daemons
d suffix, a daemon for your
/etc config, though I’ve not yet found
proof of this.
Clearly a lot of clusters out there are using etcd for critical data storage, but how does it work?
For a history of etcd see: https://coreos.com/blog/history-etcd
For bonus points: https://www.wired.com/2013/08/coreos-the-new-linux/
Roughly etcd was created out of a desire for a distributed data store addressing the following issues:
Google’s Chubby Paper was public, but Chubby itself was / is not.
Zookeeper was expensive to run, didn’t scale down, and couldn’t be interacted with via common simple tools like curl.
Initially etcd was used by coreOS'
fleet container orchestration system,
but it was quickly adopted for other uses and later donated to the CNCF.
etcdis a Go binary with a seperate CLI (
etcd exposes a gRPC service along with an HTTP JSON API.
Data is persisted in multiversion key-value format, stored on disk.
Typically one, three, or five replicas are used.
Each replica stores the full dataset, following the leader.
etcd’s upstream documentation is instructive here: github.com/etcd-io/etcd/blob/master/Documentation/learning/data_model.md
Leader election is used to maintain a single leader replica, all requests are routed to the leader internally and comitted only after acheiving consensus on the request.
Raft is the consensus algorithm used both requests and for leader elections. The official raft site is a a good reference for understanding how this works. Another great resource linked from the official site is thesecretlivesofdata.com/raft/.
etcd’s raft implementation is widely used and contains some useful documentation.
- elaborate on Kubernetes’s usage
- talk more aboult multiversion and revisions
- talk more about data model
- talk more about supported operations
The Carnegie Mellon Database Group “Database of Databases” site has a great page on etcd at dbdb.io/db/etcd