kubernetesetcd

Why kubernetes namesapce "kube-system" has pods of etcd?


I think etcd is the infrastructure of kubernetes, so it should be outside of kubernetes, instead of being pods inside kubernetes.

Why kubernetes list components in namespace "kube-system" and how does it work?

browsed some webpages, can't find answer.


Solution

  • etcd is basically the database of kubernetes, containing the current state of the cluster.

    In general there are two mode of operating it. It can run on the control-plane nodes or outside of the cluster.

    If it's running on the control-plane nodes there are two modes. It can run as regular process, like a systemd service. Or it can run as static pod.

    Static pods is a concept to decouple pods from the control-plane. If the control-plane fails (like the apiserver is down), those pods will still be running and can restart on failure, because they are managed by the kubelet on the node. You can simple place a manifest file in a certain directory (usually it's /etc/kubernetes/manifests) and kubelet will create the pod. You can tell if a pod is a static pod by the name, it has the node's name in it.

    So if you see etcd nodes in the kube-system namespace, this means that your etcd is part of the cluster and run as pods, most likely as static pods on the control-plane nodes.