Merge pull request #124465 from neolit123/1.31-add-etcd-livez-readyz

kubeadm: use etcd 3.5.11's /livez and /readyz endpoints for probes
This commit is contained in:
Kubernetes Prow Robot 2024-05-21 04:40:23 -07:00 committed by GitHub
commit 44c45484e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 17 deletions

View File

@ -319,7 +319,7 @@ const (
KubeletHealthzPort = 10248 KubeletHealthzPort = 10248
// MinExternalEtcdVersion indicates minimum external etcd version which kubeadm supports // MinExternalEtcdVersion indicates minimum external etcd version which kubeadm supports
MinExternalEtcdVersion = "3.4.13-4" MinExternalEtcdVersion = "3.5.11-0"
// DefaultEtcdVersion indicates the default etcd version that kubeadm uses // DefaultEtcdVersion indicates the default etcd version that kubeadm uses
DefaultEtcdVersion = "3.5.13-0" DefaultEtcdVersion = "3.5.13-0"
@ -481,13 +481,6 @@ var (
// SupportedEtcdVersion lists officially supported etcd versions with corresponding Kubernetes releases // SupportedEtcdVersion lists officially supported etcd versions with corresponding Kubernetes releases
SupportedEtcdVersion = map[uint8]string{ SupportedEtcdVersion = map[uint8]string{
22: "3.5.13-0",
23: "3.5.13-0",
24: "3.5.13-0",
25: "3.5.13-0",
26: "3.5.13-0",
27: "3.5.13-0",
28: "3.5.13-0",
29: "3.5.13-0", 29: "3.5.13-0",
30: "3.5.13-0", 30: "3.5.13-0",
31: "3.5.13-0", 31: "3.5.13-0",

View File

@ -124,11 +124,15 @@ func TestGetStaticPodFilepath(t *testing.T) {
} }
} }
func TestEtcdSupportedVersionLength(t *testing.T) {
const max = 3
if len(SupportedEtcdVersion) > max {
t.Fatalf("SupportedEtcdVersion must not include more than %d versions", max)
}
}
func TestEtcdSupportedVersion(t *testing.T) { func TestEtcdSupportedVersion(t *testing.T) {
var supportedEtcdVersion = map[uint8]string{ var supportedEtcdVersion = map[uint8]string{
13: "3.2.24",
14: "3.3.10",
15: "3.3.10",
16: "3.3.17-0", 16: "3.3.17-0",
17: "3.4.3-0", 17: "3.4.3-0",
18: "3.4.3-0", 18: "3.4.3-0",
@ -147,7 +151,7 @@ func TestEtcdSupportedVersion(t *testing.T) {
}, },
{ {
kubernetesVersion: "1.10.1", kubernetesVersion: "1.10.1",
expectedVersion: version.MustParseSemantic("3.2.24"), expectedVersion: version.MustParseSemantic("3.3.17-0"),
expectedWarning: true, expectedWarning: true,
expectedError: false, expectedError: false,
}, },

View File

@ -224,9 +224,12 @@ func GetEtcdPodSpec(cfg *kubeadmapi.ClusterConfiguration, endpoint *kubeadmapi.A
v1.ResourceMemory: resource.MustParse("100Mi"), v1.ResourceMemory: resource.MustParse("100Mi"),
}, },
}, },
LivenessProbe: staticpodutil.LivenessProbe(probeHostname, "/health?exclude=NOSPACE&serializable=true", probePort, probeScheme), // The etcd probe endpoints are explained here:
StartupProbe: staticpodutil.StartupProbe(probeHostname, "/health?serializable=false", probePort, probeScheme, componentHealthCheckTimeout), // https://github.com/kubernetes/kubeadm/issues/3039
Env: kubeadmutil.MergeKubeadmEnvVars(cfg.Etcd.Local.ExtraEnvs), 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, 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)

View File

@ -129,13 +129,22 @@ spec:
failureThreshold: 8 failureThreshold: 8
httpGet: httpGet:
host: 127.0.0.1 host: 127.0.0.1
path: /health?exclude=NOSPACE&serializable=true path: /livez
port: 2381 port: 2381
scheme: HTTP scheme: HTTP
initialDelaySeconds: 10 initialDelaySeconds: 10
periodSeconds: 10 periodSeconds: 10
timeoutSeconds: 15 timeoutSeconds: 15
name: etcd name: etcd
readinessProbe:
failureThreshold: 3
httpGet:
host: 127.0.0.1
path: /readyz
port: 2381
scheme: HTTP
periodSeconds: 1
timeoutSeconds: 15
resources: resources:
requests: requests:
cpu: 100m cpu: 100m
@ -144,7 +153,7 @@ spec:
failureThreshold: 24 failureThreshold: 24
httpGet: httpGet:
host: 127.0.0.1 host: 127.0.0.1
path: /health?serializable=false path: /readyz
port: 2381 port: 2381
scheme: HTTP scheme: HTTP
initialDelaySeconds: 10 initialDelaySeconds: 10