DEV Community

Catt
Catt

Posted on

day1: Intro to etcd

day 1 of the kubernetes CKA study journey - the first lesson in the KodeKloud video is on etcd - so today we're chatting about et-see-dee!

etcd is basically a highly available, distributed, reliable key-value database that is simple, secure, and fast. This is important because etcd stores all the cluster information and whenever you use kubectl get <object>, the API is querying the etcd database. It stores information regarding the cluster including nodes, pods, configurations, secrets, accounts, roles, role bindings, etc.

There are many types of databases and etcd is a key value one for the purpose of being very quick to search and retrieve information (high performance), although this also means it doesn't handle really complex queries like a SQL database might. You can, however, store complex data - you can have the key, then the value can be a set of properties, or an entire json itself.

When an etcd server is started, it starts a service on the IP address of the server that listens by default on port 2379. You can then attach clients to the etcd server to store and retrieve information. The default client is the etcdctl - the CLI client for etcd. It runs commands such as ./etcdctl put key1 value1. Note that different etcd versions have different APIs, and thus different etcdctl commands/verbs!

Every change made in a Kubernetes cluster is considered complete only when the etcd server is updated. Kubernetes stores data in a specific directory structure - root directory is a registry, and under that are the various kubernetes objects.

If you are setting up your cluster from scratch, you will have to download the etcd binary and deploy it on your master/control plane node yourself. If you are setting up your cluster with the kubeadm tool, it will deploy the etcd server as a pod in the kube-system namespace.

In a high availability environment, you may have multiple master/control plane nodes with multiple etcd servers, so you will have to ensure they know about each other by specifying this in the --initial-cluster controller parameter in the etcd.service configuration.

etcd entered the CNCF incubation as a project in 2018, and graduated November 2020.

That's all I have for today, hopefully this is solid information about etcd!

- Catt

Top comments (0)