Development kubernetes

Kubernetes Control Plane and ETCD

Kubernetes Control planes are one of the most important component while hosting kubernetes while on prem on in cloud. They store all the metadata of the cluster and store a consistent view of the cluster. It is important to understand how they work together so that we can build a successful configuration that leads to high availability service. Control planes host bunch of services, such as apiservices, dns, and etcd. Of these services, etcd plays an important role in helping control planes come up with consistent view of cluster on failovers. This is achieving by etcd using quorom. and this is also the reason, why we should always create odd numbers of controlplanes(each with its own etcd). This works great. but also creates issues in some scenarios, let’s say more than half of your control planes are unreachable. or lets’s says you have 3 control planes and 2 of them crashes. We will discuss more in detail about these scenarios and how to handle such issues efficiently.

List ETCD Member

READY_ETCD_MEMBER="etcd-kubemaster1"
ETCDCTL="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 --endpoints=https://127.0.0.1:2379"
kubectl -n kube-system exec -it "$READY_ETCD_MEMBER" -- sh -c "$ETCDCTL member list"

Replacement of crashed Control Planes

READY_ETCD_MEMBER=”etcd-kubemaster1″
ETCD_ID_TO_REMOVE=”729aac77d384f8bd”
ETCDCTL=”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 –endpoints=https://127.0.0.1:2379″
kubectl -n kube-system exec -it “$READY_ETCD_MEMBER” — sh -c “$ETCDCTL member remove $ETCD_ID_TO_REMOVE”

Author

Viram Layman

Leave a comment

Your email address will not be published. Required fields are marked *