How can we modify the heartbeat synchronization time of the etcd cluster on Kubernetes
I want to modify heartbeat-interval
of embedded etcd cluster running on kubernetes, I know while installation we can do with kubeadm extraargs but how to do in running cluster?
Before modifying I want to know current values too.
EDIT1: To get existing value use following
kubectl -n kube-system logs etcd-<NodeHostName> |grep heart
2021-06-25 11:08:31.612468 I | embed: heartbeat = 100ms
I also tried below but its not working for k8s.gcr.io/etcd:3.4.13-0
kubectl -n kube-system exec etcd-<NodeHostName> -- env|grep "ETCD_HEARTBEAT_INTERVAL"
I found following way to configure heartbeat
edit /etc/kubernetes/manifests/etcd.yaml on each etcd node and add heartbeat-interval
and election-timeout
like following, it will restart etcd so add one by one with delay so you should not lose quorm.
- command:
- etcd
- --advertise-client-urls=https://x.x.x.x:2379
- --cert-file=/etc/kubernetes/pki/etcd/server.crt
- --client-cert-auth=true
- --data-dir=/var/lib/etcd
- --initial-advertise-peer-urls=https://x.x.x.x:2380
- --initial-cluster=x.x.com=https://x.x.x.x:2380
- --key-file=/etc/kubernetes/pki/etcd/server.key
- --listen-client-urls=https://127.0.0.1:2379,https://x.x.x.x:2379
- --listen-metrics-urls=http://127.0.0.1:2381
- --listen-peer-urls=https://x.x.x.x:2380
- --name=x.x.x.x.com
- --peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt
- --peer-client-cert-auth=true
- --peer-key-file=/etc/kubernetes/pki/etcd/peer.key
- --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
- --snapshot-count=10000
- --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
- --heartbeat-interval=500
- --election-timeout=5000