From 8cd463ac68457b07cb138c34d20cbc12218eaa55 Mon Sep 17 00:00:00 2001 From: Robert Bailey Date: Tue, 4 Aug 2015 11:14:46 -0700 Subject: [PATCH] Register the kubelet on the master node with an apiserver. This option is separated from the apiserver running locally on the master node so that it can be optionally enabled or disabled as needed. Also, fix the healthchecking configuration for the master components, which was previously only working by coincidence: If a kubelet doesn't register with a master, it never bothers to figure out what its local address is. In which case it ends up constructing a URL like http://:8080/healthz for the http probe. This happens to work on the master because all of the pods are using host networking and explicitly binding to 127.0.0.1. Once the kubelet is registered with the master and it determines the local node address, it tries to healthcheck on an address where the pod isn't listening and the kubelet periodically restarts each master component when the liveness probe fails. --- high-availability/kube-apiserver.manifest | 14 +++++++++++++- high-availability/kube-controller-manager.manifest | 10 +++++++--- high-availability/kube-scheduler.manifest | 10 +++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/high-availability/kube-apiserver.manifest b/high-availability/kube-apiserver.manifest index 41f29dfe..99f0f6f7 100644 --- a/high-availability/kube-apiserver.manifest +++ b/high-availability/kube-apiserver.manifest @@ -1,7 +1,10 @@ { "apiVersion": "v1", "kind": "Pod", -"metadata": {"name":"kube-apiserver"}, +"metadata": { + "name":"kube-apiserver", + "namespace": "kube-system" +}, "spec":{ "hostNetwork": true, "containers":[ @@ -13,6 +16,15 @@ "-c", "/usr/local/bin/kube-apiserver --address=0.0.0.0 --etcd_servers=http://kube0.ha:2379 --service-cluster-ip-range=10.0.0.0/16 --v=4 --allow_privileged=True 1>>/var/log/kube-apiserver.log 2>&1" ], + "livenessProbe": { + "httpGet": { + "host": "127.0.0.1", + "port": 8080, + "path": "/healthz" + }, + "initialDelaySeconds": 15, + "timeoutSeconds": 15 + }, "ports":[ { "name": "https", "containerPort": 443, diff --git a/high-availability/kube-controller-manager.manifest b/high-availability/kube-controller-manager.manifest index 21446977..4d358da5 100644 --- a/high-availability/kube-controller-manager.manifest +++ b/high-availability/kube-controller-manager.manifest @@ -1,7 +1,10 @@ { "apiVersion": "v1", "kind": "Pod", -"metadata": {"name":"kube-controller-manager"}, +"metadata": { + "name":"kube-controller-manager", + "namespace": "kube-system" +}, "spec":{ "hostNetwork": true, "containers":[ @@ -15,8 +18,9 @@ ], "livenessProbe": { "httpGet": { - "path": "/healthz", - "port": 10252 + "host": "127.0.0.1", + "port": 10252, + "path": "/healthz" }, "initialDelaySeconds": 15, "timeoutSeconds": 1 diff --git a/high-availability/kube-scheduler.manifest b/high-availability/kube-scheduler.manifest index 43171c01..50e89d69 100644 --- a/high-availability/kube-scheduler.manifest +++ b/high-availability/kube-scheduler.manifest @@ -1,7 +1,10 @@ { "apiVersion": "v1", "kind": "Pod", -"metadata": {"name":"kube-scheduler"}, +"metadata": { + "name":"kube-scheduler", + "namespace": "kube-system" +}, "spec":{ "hostNetwork": true, "containers":[ @@ -15,8 +18,9 @@ ], "livenessProbe": { "httpGet": { - "path": "/healthz", - "port": 10251 + "host": "127.0.0.1", + "port": 10251, + "path": "/healthz" }, "initialDelaySeconds": 15, "timeoutSeconds": 1