mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
kubeadm: add serializable health checks for etcd probes
Use the etcd 3.5.3+ HTTP(s) endpoint "/health?serializable=true", to allow the kubelet liveness and starup probes in the kubeadm generated etcd.yaml (static Pod) to track individual member health instead of tracking the whole etcd cluster health.
This commit is contained in:
parent
45844049fc
commit
29148f61ac
@ -179,6 +179,7 @@ func CreateStackedEtcdStaticPodManifestFile(client clientset.Interface, manifest
|
|||||||
// GetEtcdPodSpec returns the etcd static Pod actualized to the context of the current configuration
|
// GetEtcdPodSpec returns the etcd static Pod actualized to the context of the current configuration
|
||||||
// NB. GetEtcdPodSpec methods holds the information about how kubeadm creates etcd static pod manifests.
|
// NB. GetEtcdPodSpec methods holds the information about how kubeadm creates etcd static pod manifests.
|
||||||
func GetEtcdPodSpec(cfg *kubeadmapi.ClusterConfiguration, endpoint *kubeadmapi.APIEndpoint, nodeName string, initialCluster []etcdutil.Member) v1.Pod {
|
func GetEtcdPodSpec(cfg *kubeadmapi.ClusterConfiguration, endpoint *kubeadmapi.APIEndpoint, nodeName string, initialCluster []etcdutil.Member) v1.Pod {
|
||||||
|
const etcdHealthEndpoint = "/health?serializable=true"
|
||||||
pathType := v1.HostPathDirectoryOrCreate
|
pathType := v1.HostPathDirectoryOrCreate
|
||||||
etcdMounts := map[string]v1.Volume{
|
etcdMounts := map[string]v1.Volume{
|
||||||
etcdVolumeName: staticpodutil.NewVolume(etcdVolumeName, cfg.Etcd.Local.DataDir, &pathType),
|
etcdVolumeName: staticpodutil.NewVolume(etcdVolumeName, cfg.Etcd.Local.DataDir, &pathType),
|
||||||
@ -203,8 +204,8 @@ func GetEtcdPodSpec(cfg *kubeadmapi.ClusterConfiguration, endpoint *kubeadmapi.A
|
|||||||
v1.ResourceMemory: resource.MustParse("100Mi"),
|
v1.ResourceMemory: resource.MustParse("100Mi"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
LivenessProbe: staticpodutil.LivenessProbe(probeHostname, "/health", probePort, probeScheme),
|
LivenessProbe: staticpodutil.LivenessProbe(probeHostname, etcdHealthEndpoint, probePort, probeScheme),
|
||||||
StartupProbe: staticpodutil.StartupProbe(probeHostname, "/health", probePort, probeScheme, cfg.APIServer.TimeoutForControlPlane),
|
StartupProbe: staticpodutil.StartupProbe(probeHostname, etcdHealthEndpoint, probePort, probeScheme, cfg.APIServer.TimeoutForControlPlane),
|
||||||
},
|
},
|
||||||
etcdMounts,
|
etcdMounts,
|
||||||
// etcd will listen on the advertise address of the API server, in a different port (2379)
|
// etcd will listen on the advertise address of the API server, in a different port (2379)
|
||||||
|
Loading…
Reference in New Issue
Block a user