Sync static pods from Kubelet to the API server

Currently, API server is not aware of the static pods (manifests from
sources other than the API server, e.g. file and http) at all. This is
inconvenient since users cannot check the static pods through kubectl.
It is also sub-optimal because scheduler is unaware of the resource
consumption by these static pods on the node.

This change syncs the information back to the API server by creating a
mirror pod via API server for each static pod.

 - Kubelet creates containers for the static pod, as it would do
   normally.

 - If a mirror pod gets deleted, Kubelet will re-create one. The
   containers are sync'd to the static pods, so they will not be
   affected.

 - If a static pod gets removed from the source (e.g. manifest file
   removed from the directory), the orphaned mirror pod will be deleted.

Note that because events are associated with UID, and the mirror pod has
a different UID than the original static pod, the events will not be
shown for the mirror pod when running `kubectl describe pod
<mirror_pod>`.
This commit is contained in:
Yu-Ju Hong
2015-03-09 15:46:47 -07:00
parent 2c97522692
commit 929fb63b33
14 changed files with 554 additions and 79 deletions

View File

@@ -244,7 +244,8 @@ func SimpleRunKubelet(client *client.Client,
masterServiceNamespace string,
volumePlugins []volume.Plugin,
tlsOptions *kubelet.TLSOptions,
cadvisorInterface cadvisor.Interface) {
cadvisorInterface cadvisor.Interface,
configFilePath string) {
kcfg := KubeletConfig{
KubeClient: client,
DockerClient: dockerClient,
@@ -264,6 +265,7 @@ func SimpleRunKubelet(client *client.Client,
VolumePlugins: volumePlugins,
TLSOptions: tlsOptions,
CadvisorInterface: cadvisorInterface,
ConfigFile: configFilePath,
}
RunKubelet(&kcfg)
}