Journey to the Center of Kubernetes
The talk is based on a blog post: Onwards to the Core: etcd. A shell transcript can be found here:
We learned about the API of etcd, its data model, key value stores layouts, append-only storage and compaction. A recording of the talk is available on YouTube:
A few highlights from the talk:
- etcd is a distributed key value store, using the RAFT consensus algorithm.
Consensus algorithms allow a collection of machinesto work as a coherent group that can survive the fail-ures of some of its members. Because of this, they play akey role in building reliable large-scale software systems. – In Search of an Understandable Consensus Algorithm
- etcd internally uses boltdb, especially their own fork, as the original project has been archived – boltdb itself is a Go implementation of the LMDB design, which among many other things supports MVCC
- etcd had hierarchical, but moved to a flat key value design; albeit you can
mimick hierarchy by using, e.g. path like notation; you can use the
--prefixflag to mimick recursive lists
ResourceVersionrelates directly to the revision in etcd; which is a monotonically increasing counter
- kubernetes does not need to use etcd (others use sqlite3 or Cosmos DB), but etcd is the most common choice
- etcd comes with an HTTP and a gRPC API
- compaction in etcd is key to limit overall database size
Kubernetes uses etcd as a registry with components starting to watch specific keys for events.
- the difference between edge-driven (a sequence of events that leads to a state) and level-driven (transmit the whole state at once) design and its reflection in the API (e.g. add, update, delete vs reconcile).
Some tools mentioned or used in the talk:
- jq, and its base64 capabilities
- delta for diffs
- auger - encodes and decodes Kubernetes objects from the binary storage encoding used to store data to etcd
- jaeger or zipkin for tracing
- zap for structured logging
- Does your favorite encoding schema support tree structures natively? Would you be interested in an encoding that supports one? Please share your ideas at concise-encoding/issues/33
- Cuelang - a language for configuration, database schemas, validation and more - e.g. to adress subtle issues like different int max sizes across languages
- Two cloud native books: Design Patterns for Cloud Native Applications and Cloud Native Patterns
- Peter Alvaro at Strange Loop (2015, Distributed Systems, Data Management Systems)
Join our meetup to get notified of upcoming events!