Skip to main content

ETCD

A distributed reliable KV store that is Simple, Secure, and Fast

ETCD is the database that the k8s api stores all information from.

All information seen in kubectl get command is from etcd server.

Every change you make to your cluster is updated in the etcd server. Only once it’s updated in the etcd server is the change complete

Install MethodRuns as
kubeadmpod
hard-waysystemd service

“Advertise Client URLs” The address that ETCD listens. IP of the server, port 2379

If installed as a cluster, set —initial-cluster controller-0 and initial-cluster-controller-1 in the etcd startup scripts.

Only spoken to by kube-apiserver!!

See Also

High Availability

You can read ETCd data from any node, but when a write request comes in, its handled by the leader If a write is sent to a follower instead of the leader, the write is forwarded to the leader internally Once a write is procssed, copies of the write go to other instances in the cluster.

A write is only considered complete if a leader gets consent from other members in the cluster.

ETCd implements Leader Election using RAFT protocol. RAFT uses random timers to initial requests. The first one to finish the timer sends a request to other nodes, requesting permissions to be the leader. Other nodes response with their vote. Now that it is elected the leader, it sends out regular notices that it is continuing the leader work.

If the leader goes down, the nodes initial a re-election process, and a new leader is identified.

Completed Writes

A write is considered complete if it can be written to a MAJORITY of the nodes in a cluster. If a node is down in a 3 node cluster, the write is completed if 2 nodes agree.

Quorum : Minimum nodes available for there to be a successful write. Quorum int((N/2)+1)

In a 2 node cluster - majority is 2! Which means if one fails, there can be no quorum.

Fault Tolerance - Number of nodes you can loose keeping the cluster alive. (N-Quorum)

Select an odd number of ETCD master nodes, as even numbers don't offer any more fault tolerance.

Creating an ETCd cluster

Make sure to use --initial-cluster peer-1=ip:2380peer-2=ip2:2380