1

I was trying to understand how exactly the kubernetes modules interacts with etcd. I understand kubernetes modules by themselves are stateless and they keep the states in etcd. But I am confused when it comes to how modules are interacting with etcd. I see conflicting texts on this, some saying all etcd interactions are happening through apiserver and some others say all the modules interacts with etcd.

I am looking for the possibility of changing etcd endpoint and restarting integration points so that they can work with new etcd instance. I do not have time to go look in to the code to understand this part so hoping the someone here can help me on this.

joe
  • 1,136
  • 9
  • 17

2 Answers2

2

If a kubernete component want to communicate with etcd, it must know the endpoint of etcd.

If you check the spec config of these components, you will find the correct answer: only api-server directly talk to etcd.

menya
  • 1,459
  • 7
  • 8
  • So ApiServer is the only component directly talks to etcd. Do you know about flannel/calico ? Do they interact with etcd directly? One more question - my actual requirement is to migrate entire kube master (single master server based) to a different server. and I am thinking about taking etcd backup and restore on a different (standby) master. Do you think this will work ? are there any gotchas? – joe Jun 24 '19 at 18:58
  • flannel just use etcd to store config, but use configmap as config without etcd is OK. calico use etcd to store some import communication info, so etcd is needed. – menya Jun 25 '19 at 02:21
  • It's hard to migrate single master. To make everything works, you should [backup and restore etcd data](https://labs.consol.de/kubernetes/2018/05/25/kubeadm-backup.html) on master node. I think keeping nodeIP and nodeName is required. – menya Jun 25 '19 at 02:26
  • Thanks for the link! That's exactly I had in mind. We have a special case and want to setup k8s in HA active/standby masters. Ours is not a high volatility system. So I am exploring the possibility of taking etcd backup on master and restoring on standby on switchover to make standby state change to see if I can keep the running pods intact. – joe Jun 25 '19 at 03:46
1

All kubernetes components, such as, kubelet, kubeproxy, scheduler, controllers etc. interact with etcd through API server. They dont directly talk to etcd.

if you change etcd endpoint, then same should be updated in api server configuration.

P Ekambaram
  • 15,499
  • 7
  • 34
  • 59
  • So ApiServer is the only component directly talks to etcd. Do you know about flannel/calico ? Do they interact with etcd directly? One more question - my actual requirement is to migrate entire kube master (single master server based) to a different server. and I am thinking about taking etcd backup and restore on a different (standby) master. Do you think this will work ? are there any gotchas? – joe Jun 24 '19 at 18:57