1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-17 15:40:07 +00:00

use healthz endpoint for kubelet healthcheck

This commit is contained in:
galal-hussein
2019-07-18 22:42:01 +02:00
committed by Alena Prokharchyk
parent 6c5321d4e3
commit 55b1b4db7c
3 changed files with 9 additions and 12 deletions

View File

@@ -19,7 +19,7 @@ import (
"github.com/rancher/rke/pki"
"github.com/rancher/rke/services"
"github.com/rancher/rke/util"
"github.com/rancher/types/apis/management.cattle.io/v3"
v3 "github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
)
@@ -350,6 +350,11 @@ func (c *Cluster) BuildKubeletProcess(host *hosts.Host, prefixPath string, svcOp
"pod-infra-container-image": c.Services.Kubelet.InfraContainerImage,
"root-dir": path.Join(prefixPath, "/var/lib/kubelet"),
}
if c.DinD {
CommandArgs["healthz-bind-address"] = "0.0.0.0"
}
if host.IsControl && !host.IsWorker {
CommandArgs["register-with-taints"] = unschedulableControlTaint
}
@@ -435,7 +440,7 @@ func (c *Cluster) BuildKubeletProcess(host *hosts.Host, prefixPath string, svcOp
Binds = append(Binds, c.Services.Kubelet.ExtraBinds...)
healthCheck := v3.HealthCheck{
URL: services.GetHealthCheckURL(true, services.KubeletPort),
URL: services.GetHealthCheckURL(false, services.KubeletPort),
}
registryAuthConfig, _, _ := docker.GetImageRegistryConfig(c.Services.Kubelet.Image, c.PrivateRegistriesMap)

View File

@@ -33,14 +33,6 @@ func runHealthcheck(ctx context.Context, host *hosts.Host, serviceName string, l
if err != nil {
return err
}
if serviceName == KubeletContainerName {
certificate := cert.EncodeCertPEM(certMap[pki.KubeNodeCertName].Certificate)
key := cert.EncodePrivateKeyPEM(certMap[pki.KubeNodeCertName].Key)
x509Pair, err = tls.X509KeyPair(certificate, key)
if err != nil {
return err
}
}
if serviceName == KubeAPIContainerName {
certificate := cert.EncodeCertPEM(certMap[pki.KubeAPICertName].Certificate)
key := cert.EncodePrivateKeyPEM(certMap[pki.KubeAPICertName].Key)

View File

@@ -10,7 +10,7 @@ import (
"github.com/rancher/rke/hosts"
"github.com/rancher/rke/log"
"github.com/rancher/rke/util"
"github.com/rancher/types/apis/management.cattle.io/v3"
v3 "github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
)
@@ -43,7 +43,7 @@ const (
KubeAPIPort = 6443
SchedulerPort = 10251
KubeControllerPort = 10252
KubeletPort = 10250
KubeletPort = 10248
KubeproxyPort = 10256
WorkerThreads = util.WorkerThreads