Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 2.57 KB

File metadata and controls

44 lines (35 loc) · 2.57 KB

ETCD in Kubernetes

In this section, we will take a look at ETCD role in kubernetes

ETCD Datastore

  • The ETCD Datastore stores information regarding the cluster such as Nodes, PODS, Configs, Secrets, Accounts, Roles, Bindings and Others.
  • Every information you see when you run the kubectl get command is from the ETCD Server.

Setup - Manual

  • If you setup your cluster from scratch then you deploy ETCD by downloading ETCD Binaries yourself

  • Installing Binaries and Configuring ETCD as a service in your master node yourself.

    $ wget -q --https-only "https://github.com/etcd-io/etcd/releases/download/v3.3.11/etcd-v3.3.11-linux-amd64.tar.gz"
    

    etcd

Setup - Kubeadm

  • If you setup your cluster using kubeadm then kubeadm will deploy etcd server for you as a pod in kube-system namespace.
    $ kubectl get pods -n kube-system
    
    etcd1

Explore ETCD

  • To list all keys stored by kubernetes, run the below command

    $ kubectl exec etcd-master -n kube-system -- sh -c "ETCDCTL_API=3 etcdctl --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key --cacert=/etc/kubernetes/pki/etcd/ca.crt get / --prefix --keys-only"
    
  • Kubernetes Stores data in a specific directory structure, the root directory is the registry and under that you have various kubernetes constructs such as minions, nodes, pods, replicasets, deployments, roles, secrets and Others.

    etcdctl1

ETCD in HA Environment

  • In a high availability environment, you will have multiple master nodes in your cluster that will have multiple ETCD Instances spread across the master nodes.
  • Make sure etcd instances know each other by setting the right parameter in the etcd.service configuration. The --initial-cluster option where you need to specify the different instances of the etcd service. etcd-ha

K8s Reference Docs: