From eeac2dda7091c1f1ea100e7637291bba2345bb0b Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Tue, 23 Apr 2024 10:50:14 +0300 Subject: [PATCH] kubeadm: use new etcd /livez and /readyz endpoints etcd >= 3.5.11 includes new endpoints for liveness, startup and readyness probes. Use them in 1.31. --- cmd/kubeadm/app/phases/etcd/local.go | 9 ++++++--- cmd/kubeadm/app/phases/etcd/local_test.go | 13 +++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/cmd/kubeadm/app/phases/etcd/local.go b/cmd/kubeadm/app/phases/etcd/local.go index 10e60807af2..93d10e6f1c8 100644 --- a/cmd/kubeadm/app/phases/etcd/local.go +++ b/cmd/kubeadm/app/phases/etcd/local.go @@ -224,9 +224,12 @@ func GetEtcdPodSpec(cfg *kubeadmapi.ClusterConfiguration, endpoint *kubeadmapi.A v1.ResourceMemory: resource.MustParse("100Mi"), }, }, - LivenessProbe: staticpodutil.LivenessProbe(probeHostname, "/health?exclude=NOSPACE&serializable=true", probePort, probeScheme), - StartupProbe: staticpodutil.StartupProbe(probeHostname, "/health?serializable=false", probePort, probeScheme, componentHealthCheckTimeout), - Env: kubeadmutil.MergeKubeadmEnvVars(cfg.Etcd.Local.ExtraEnvs), + // The etcd probe endpoints are explained here: + // https://github.com/kubernetes/kubeadm/issues/3039 + LivenessProbe: staticpodutil.LivenessProbe(probeHostname, "/livez", probePort, probeScheme), + ReadinessProbe: staticpodutil.ReadinessProbe(probeHostname, "/readyz", probePort, probeScheme), + StartupProbe: staticpodutil.StartupProbe(probeHostname, "/readyz", probePort, probeScheme, componentHealthCheckTimeout), + Env: kubeadmutil.MergeKubeadmEnvVars(cfg.Etcd.Local.ExtraEnvs), }, etcdMounts, // etcd will listen on the advertise address of the API server, in a different port (2379) diff --git a/cmd/kubeadm/app/phases/etcd/local_test.go b/cmd/kubeadm/app/phases/etcd/local_test.go index e04c8655eb5..50cd5a96c6c 100644 --- a/cmd/kubeadm/app/phases/etcd/local_test.go +++ b/cmd/kubeadm/app/phases/etcd/local_test.go @@ -129,13 +129,22 @@ spec: failureThreshold: 8 httpGet: host: 127.0.0.1 - path: /health?exclude=NOSPACE&serializable=true + path: /livez port: 2381 scheme: HTTP initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 15 name: etcd + readinessProbe: + failureThreshold: 3 + httpGet: + host: 127.0.0.1 + path: /readyz + port: 2381 + scheme: HTTP + periodSeconds: 1 + timeoutSeconds: 15 resources: requests: cpu: 100m @@ -144,7 +153,7 @@ spec: failureThreshold: 24 httpGet: host: 127.0.0.1 - path: /health?serializable=false + path: /readyz port: 2381 scheme: HTTP initialDelaySeconds: 10