Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/healthchecker/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
18 changes: 9 additions & 9 deletions pkg/healthchecker/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,47 +110,47 @@ 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",
envConfig: map[string]string{
"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",
envConfig: map[string]string{
"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",
envConfig: map[string]string{
"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",
envConfig: map[string]string{
"KUBELET_PORT": "12345",
},
expectedKubeletEndpoint: "http://localhost:12345/healthz",
expectedKubeProxyEndpoint: "http://localhost:10256/healthz",
expectedKubeProxyEndpoint: "http://localhost:10256/livez",
},
{
name: "KUBEPROXY_PORT override supplied",
envConfig: map[string]string{
"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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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 {
Expand Down