mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-19 12:16:26 +00:00
healthchecker: use kube-proxy /livez to avoid scale-down false alerts
Cluster Autoscaler marks nodes with ToBeDeletedByClusterAutoscaler during scale-down. kube-proxy /healthz intentionally fails in that case for LB connection draining (KEP-3836), which made NPD report kube-proxy as unhealthy. Switch the kube-proxy probe to /livez, which reflects process health only. Signed-off-by: dpacgdm <dpac.gdm@gmail.com>
This commit is contained in:
@@ -80,7 +80,10 @@ func setKubeEndpoints() {
|
||||
}
|
||||
|
||||
kubeletHealthCheckEndpoint = fmt.Sprintf("http://%s/healthz", net.JoinHostPort(hostAddress, kubeletPort))
|
||||
kubeProxyHealthCheckEndpoint = fmt.Sprintf("http://%s/healthz", net.JoinHostPort(hostAddress, kubeProxyPort))
|
||||
// Use /livez for kube-proxy so Cluster Autoscaler scale-down (ToBeDeletedByClusterAutoscaler
|
||||
// taint) does not make NPD report kube-proxy as unhealthy. /healthz intentionally fails in
|
||||
// that case for load-balancer connection draining (KEP-3836); /livez only reflects process health.
|
||||
kubeProxyHealthCheckEndpoint = fmt.Sprintf("http://%s/livez", net.JoinHostPort(hostAddress, kubeProxyPort))
|
||||
}
|
||||
|
||||
func KubeProxyHealthCheckEndpoint() string {
|
||||
|
||||
@@ -110,7 +110,7 @@ func TestKubeEndpointConfiguration(t *testing.T) {
|
||||
name: "no overrides supplied",
|
||||
envConfig: map[string]string{},
|
||||
expectedKubeletEndpoint: "http://localhost:10248/healthz",
|
||||
expectedKubeProxyEndpoint: "http://localhost:10256/healthz",
|
||||
expectedKubeProxyEndpoint: "http://localhost:10256/livez",
|
||||
},
|
||||
{
|
||||
name: "HOST_ADDRESS override supplied",
|
||||
@@ -118,7 +118,7 @@ func TestKubeEndpointConfiguration(t *testing.T) {
|
||||
"HOST_ADDRESS": "samplehost.testdomain.com",
|
||||
},
|
||||
expectedKubeletEndpoint: "http://samplehost.testdomain.com:10248/healthz",
|
||||
expectedKubeProxyEndpoint: "http://samplehost.testdomain.com:10256/healthz",
|
||||
expectedKubeProxyEndpoint: "http://samplehost.testdomain.com:10256/livez",
|
||||
},
|
||||
{
|
||||
name: "HOST_ADDRESS override supplied with IPv4",
|
||||
@@ -126,7 +126,7 @@ func TestKubeEndpointConfiguration(t *testing.T) {
|
||||
"HOST_ADDRESS": "10.0.5.4",
|
||||
},
|
||||
expectedKubeletEndpoint: "http://10.0.5.4:10248/healthz",
|
||||
expectedKubeProxyEndpoint: "http://10.0.5.4:10256/healthz",
|
||||
expectedKubeProxyEndpoint: "http://10.0.5.4:10256/livez",
|
||||
},
|
||||
{
|
||||
name: "HOST_ADDRESS override supplied with IPv6",
|
||||
@@ -134,7 +134,7 @@ func TestKubeEndpointConfiguration(t *testing.T) {
|
||||
"HOST_ADDRESS": "80:f4:16::1",
|
||||
},
|
||||
expectedKubeletEndpoint: "http://[80:f4:16::1]:10248/healthz",
|
||||
expectedKubeProxyEndpoint: "http://[80:f4:16::1]:10256/healthz",
|
||||
expectedKubeProxyEndpoint: "http://[80:f4:16::1]:10256/livez",
|
||||
},
|
||||
{
|
||||
name: "KUBELET_PORT override supplied",
|
||||
@@ -142,7 +142,7 @@ func TestKubeEndpointConfiguration(t *testing.T) {
|
||||
"KUBELET_PORT": "12345",
|
||||
},
|
||||
expectedKubeletEndpoint: "http://localhost:12345/healthz",
|
||||
expectedKubeProxyEndpoint: "http://localhost:10256/healthz",
|
||||
expectedKubeProxyEndpoint: "http://localhost:10256/livez",
|
||||
},
|
||||
{
|
||||
name: "KUBEPROXY_PORT override supplied",
|
||||
@@ -150,7 +150,7 @@ func TestKubeEndpointConfiguration(t *testing.T) {
|
||||
"KUBEPROXY_PORT": "12345",
|
||||
},
|
||||
expectedKubeletEndpoint: "http://localhost:10248/healthz",
|
||||
expectedKubeProxyEndpoint: "http://localhost:12345/healthz",
|
||||
expectedKubeProxyEndpoint: "http://localhost:12345/livez",
|
||||
},
|
||||
{
|
||||
name: "HOST_ADDRESS and KUBELET_PORT override supplied",
|
||||
@@ -159,7 +159,7 @@ func TestKubeEndpointConfiguration(t *testing.T) {
|
||||
"KUBELET_PORT": "12345",
|
||||
},
|
||||
expectedKubeletEndpoint: "http://samplehost.testdomain.com:12345/healthz",
|
||||
expectedKubeProxyEndpoint: "http://samplehost.testdomain.com:10256/healthz",
|
||||
expectedKubeProxyEndpoint: "http://samplehost.testdomain.com:10256/livez",
|
||||
},
|
||||
{
|
||||
name: "HOST_ADDRESS and KUBEPROXY_PORT override supplied",
|
||||
@@ -168,7 +168,7 @@ func TestKubeEndpointConfiguration(t *testing.T) {
|
||||
"KUBEPROXY_PORT": "12345",
|
||||
},
|
||||
expectedKubeletEndpoint: "http://samplehost.testdomain.com:10248/healthz",
|
||||
expectedKubeProxyEndpoint: "http://samplehost.testdomain.com:12345/healthz",
|
||||
expectedKubeProxyEndpoint: "http://samplehost.testdomain.com:12345/livez",
|
||||
},
|
||||
{
|
||||
name: "HOST_ADDRESS, KUBELET_PORT and KUBEPROXY_PORT override supplied",
|
||||
@@ -178,7 +178,7 @@ func TestKubeEndpointConfiguration(t *testing.T) {
|
||||
"KUBEPROXY_PORT": "12346",
|
||||
},
|
||||
expectedKubeletEndpoint: "http://10.0.10.1:12345/healthz",
|
||||
expectedKubeProxyEndpoint: "http://10.0.10.1:12346/healthz",
|
||||
expectedKubeProxyEndpoint: "http://10.0.10.1:12346/livez",
|
||||
},
|
||||
}
|
||||
for _, test := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user