Getting Started with Kubernetes | etcd

1. Development History of etcd

2. Architecture and Internal Mechanism Analysis

Overall Architecture

API Introduction

  • Put and Delete: As shown in the preceding figure, the Put and Delete operations are simple. Only a key and a value are required to write data to the cluster, and only the key is required to delete data.
  • Get: etcd supports query by a specified key and query by a specified key range.
  • Watch: etcd provides a Watch mechanism to subscribe to the incremental data updates in etcd in real time. Watch allows you to specify a key or a key prefix. Generally, the latter option is used.
  • Transactions: etcd provides a simple transaction mechanism to perform certain operations when one set of conditions is met or perform other operations when the conditions are not met. This is similar to the if…else statement used in code. etcd ensures the atomicity of all operations.
  • Leases: The Leases API is a common design mode in distributed systems.

Data Version Mechanism

  • create_revision is the revision of the key-value data upon creation.
  • mod_revision is the revision upon data operations.
  • A counter specifies how many times the key-value data has been modified.

MVCC and Streaming Watch

Mini Transaction


3. Typical Scenarios

Metadata Storage

Service Discovery (Naming Service)

  • After the process is started, the address of the process can be registered with etcd.
  • API Gateway can promptly detect the backend process address by using etcd. When a failover occurs, the new process address is registered with etcd, and API Gateway can promptly detect the new address.
  • If the serving process crashes, API Gateway can remove its traffic to prevent call timeout by using the etcd lease mechanism.

Distributed Coordination: Leader Election

Distributed Coordination: Distributed System Concurrency Control


  • The first part describes the emergence of etcd and several important moments during its evolution.
  • The second part introduces the architecture and basic APIs of etcd, as well as basic etcd data operations and how etcd works.
  • The third part describes three typical etcd scenarios and the design ideas of distributed systems in these scenarios.

Original Source:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: