Control
Plane or Master Node Components
The major k8 components run on the master nodes. There will be very
limited number of these nodes based on our cluster. These master nodes run the
important components of K8. These masters nodes will always be in odd numbers
like 1,3 or 5 etc. This is because of the Quorum. A Quorum is not necessarily a
majority of members of the group but the minimum needed in order to conduct
business. For example, of 2 members of the group are absent, there can still be
a quorum meaning they can conduct business without them.
If you have 3 masters and 2 of them are out of business , we can still
run the cluster with one master.
Etcd - This is the very core component and heart of
the cluster. This just stores data as a key value pair. Etcd is an open-source
distributed key-value store that serves as a backbone for cluster coordination and state management.
For example , if we have a job scheduler that need to notify a machine
that has job to do and once the job is done it again needs to share this
information with other systems. Now we will need source of truth box to save
the details so that it is sent to other components on a timely and reliable
manner. This is where ETCD comes into picture. It saves the job details so that
a coordination engine will read and pass the data to other components. So
anything happening in the cluster will be saved to the ETCD.
Some of the main features of Etcd are,
Compare-and-swap ( CAS ) - This is one of the feature of Etcd. This is
an atomic operation that result in comparing the contents of the location with
a given value and only if they are same modifies the contents with new value.
In Etcd if we have written a key:value , and if we want to save new value, it
uses the same concept of Compare-and-swap. These assurances enable the system to
safely have multiple threads manipulating data in etcd without the need for
pessimistic locks which can significantly reduce throughput to the server.
Watches - Etcd also has a Watch protocol which watches for key
changes. This watch works in a different way, rather than client polling for
changes to the keys watch waits for changes to keys by continuously watching
them and sending the details back to the client
RAFT - RAFT algorithm which make sure that even if one of the etcd
goes down or fails there will be enough replication available to store data and
once the dead one is available it re connects to the cluster.
How Does K8 Use ETCD?
All K8 objects like pods, deployments, service etc that are created in
a cluster are stored in Etcd so that they survive failures. K8 allows to run
multiple instances of etcd.The Only component that talks to etcd is Api Server.
All other components read and write data to the etcd using the Api server.
Etcd implements hierarchical structure which makes key-value pairs
similar to files in the file system. Each key in etcd is either a directory, which
contains other keys, or is a regular key with a corresponding value. Depending
on the value being stored ( if slash includes ), the value can be located in
multiple sub-directories.
No comments :
Post a Comment