Documentation
¶
Overview ¶
Package kubelet is the package that contains the libraries that drive the Kubelet binary. The kubelet is responsible for node level pod management. It runs on each worker in the cluster.
Index ¶
- Constants
- Variables
- func CapacityFromMachineInfo(info *cadvisorApi.MachineInfo) api.ResourceList
- func GetPhase(spec *api.PodSpec, info []api.ContainerStatus) api.PodPhase
- func GetValidatedSources(sources []string) ([]string, error)
- func ListenAndServeKubeletReadOnlyServer(host HostInterface, address net.IP, port uint)
- func ListenAndServeKubeletServer(host HostInterface, address net.IP, port uint, tlsOptions *TLSOptions, ...)
- func ServePortForward(w http.ResponseWriter, req *http.Request, portForwarder PortForwarder, ...)
- type ContainerGCPolicy
- type DiskSpacePolicy
- type HostInterface
- type ImageGCPolicy
- type KernelTunableBehavior
- type Kubelet
- func (kl *Kubelet) AttachContainer(podFullName string, podUID types.UID, containerName string, stdin io.Reader, ...) error
- func (kl *Kubelet) BirthCry()
- func (kl *Kubelet) ExecInContainer(podFullName string, podUID types.UID, containerName string, cmd []string, ...) error
- func (kl *Kubelet) GenerateRunContainerOptions(pod *api.Pod, container *api.Container) (*kubecontainer.RunContainerOptions, error)
- func (kl *Kubelet) GetCachedMachineInfo() (*cadvisorApi.MachineInfo, error)
- func (kl *Kubelet) GetContainerInfo(podFullName string, podUID types.UID, containerName string, ...) (*cadvisorApi.ContainerInfo, error)
- func (kl *Kubelet) GetContainerRuntimeVersion() (kubecontainer.Version, error)
- func (kl *Kubelet) GetHostIP() (net.IP, error)
- func (kl *Kubelet) GetHostname() string
- func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName string, logOptions *api.PodLogOptions, ...) error
- func (kl *Kubelet) GetNode() (*api.Node, error)
- func (kl *Kubelet) GetPodByFullName(podFullName string) (*api.Pod, bool)
- func (kl *Kubelet) GetPodByName(namespace, name string) (*api.Pod, bool)
- func (kl *Kubelet) GetPods() []*api.Pod
- func (kl *Kubelet) GetRawContainerInfo(containerName string, req *cadvisorApi.ContainerInfoRequest, ...) (map[string]*cadvisorApi.ContainerInfo, error)
- func (kl *Kubelet) GetRunningPods() ([]*api.Pod, error)
- func (kl *Kubelet) GetRuntime() kubecontainer.Runtime
- func (kl *Kubelet) HandlePodAdditions(pods []*api.Pod)
- func (kl *Kubelet) HandlePodCleanups() error
- func (kl *Kubelet) HandlePodDeletions(pods []*api.Pod)
- func (kl *Kubelet) HandlePodSyncs(pods []*api.Pod)
- func (kl *Kubelet) HandlePodUpdates(pods []*api.Pod)
- func (kl *Kubelet) LatestLoopEntryTime() time.Time
- func (kl *Kubelet) ListenAndServe(address net.IP, port uint, tlsOptions *TLSOptions, ...)
- func (kl *Kubelet) ListenAndServeReadOnly(address net.IP, port uint)
- func (kl *Kubelet) PortForward(podFullName string, podUID types.UID, port uint16, stream io.ReadWriteCloser) error
- func (kl *Kubelet) ResyncInterval() time.Duration
- func (kl *Kubelet) Run(updates <-chan PodUpdate)
- func (kl *Kubelet) RunInContainer(podFullName string, podUID types.UID, containerName string, cmd []string) ([]byte, error)
- func (kl *Kubelet) RunOnce(updates <-chan PodUpdate) ([]RunPodResult, error)
- func (kl *Kubelet) ServeLogs(w http.ResponseWriter, req *http.Request)
- func (kl *Kubelet) StartGarbageCollection()
- func (kl *Kubelet) StreamingConnectionIdleTimeout() time.Duration
- type OOMWatcher
- type PodOperation
- type PodUpdate
- type PodWorkers
- type PortForwarder
- type RunPodResult
- type Server
- type SourcesReadyFn
- type StatsRequest
- type SyncHandler
- type SyncPodType
- type TLSOptions
- type TestingInterface
Constants ¶
const ( // The percent of the machine memory capacity. The value is used to calculate // docker memory resource container's hardlimit to workaround docker memory // leakage issue. Please see kubernetes/issues/9881 for more detail. DockerMemoryLimitThresholdPercent = 70 // The minimum memory limit allocated to docker container: 150Mi MinDockerMemoryLimit = 150 * 1024 * 1024 )
const ( RunOnceManifestDelay = 1 * time.Second RunOnceMaxRetries = 10 RunOnceRetryDelay = 1 * time.Second RunOnceRetryDelayBackoff = 2 )
const ( // This is the current pod configuration SET PodOperation = iota // Pods with the given ids are new to this source ADD // Pods with the given ids have been removed from this source REMOVE // Pods with the given ids have been updated in this source UPDATE // These constants identify the sources of pods // Updates from a file FileSource = "file" // Updates from querying a web page HTTPSource = "http" // Updates from Kubernetes API Server ApiserverSource = "api" // Updates from all sources AllSource = "*" NamespaceDefault = api.NamespaceDefault )
const ConfigFirstSeenAnnotationKey = "kubernetes.io/config.seen"
const ConfigHashAnnotationKey = "kubernetes.io/config.hash"
const ConfigMirrorAnnotationKey = "kubernetes.io/config.mirror"
const ConfigSourceAnnotationKey = "kubernetes.io/config.source"
const (
// system default DNS resolver configuration
ResolvConfDefault = "/etc/resolv.conf"
)
Variables ¶
var ( // ErrContainerNotFound returned when a container in the given pod with the // given container name was not found, amongst those managed by the kubelet. ErrContainerNotFound = errors.New("no matching container") )
Functions ¶
func CapacityFromMachineInfo ¶ added in v0.14.0
func CapacityFromMachineInfo(info *cadvisorApi.MachineInfo) api.ResourceList
func GetPhase ¶ added in v0.20.0
GetPhase returns the phase of a pod given its container info. This func is exported to simplify integration with 3rd party kubelet integrations like kubernetes-mesos.
func GetValidatedSources ¶ added in v0.14.0
Gets all validated sources from the specified sources.
func ListenAndServeKubeletReadOnlyServer ¶ added in v0.15.0
func ListenAndServeKubeletReadOnlyServer(host HostInterface, address net.IP, port uint)
ListenAndServeKubeletReadOnlyServer initializes a server to respond to HTTP network requests on the Kubelet.
func ListenAndServeKubeletServer ¶
func ListenAndServeKubeletServer(host HostInterface, address net.IP, port uint, tlsOptions *TLSOptions, enableDebuggingHandlers bool)
ListenAndServeKubeletServer initializes a server to respond to HTTP network requests on the Kubelet.
func ServePortForward ¶ added in v1.1.1
func ServePortForward(w http.ResponseWriter, req *http.Request, portForwarder PortForwarder, podName string, uid types.UID, idleTimeout time.Duration, streamCreationTimeout time.Duration)
ServePortForward handles a port forwarding request. A single request is kept alive as long as the client is still alive and the connection has not been timed out due to idleness. This function handles multiple forwarded connections; i.e., multiple `curl http://localhost:8888/` requests will be handled by a single invocation of ServePortForward.
Types ¶
type ContainerGCPolicy ¶ added in v0.14.0
type ContainerGCPolicy struct {
// Minimum age at which a container can be garbage collected, zero for no limit.
MinAge time.Duration
// Max number of dead containers any single pod (UID, container name) pair is
// allowed to have, less than zero for no limit.
MaxPerPodContainer int
// Max number of total dead containers, less than zero for no limit.
MaxContainers int
}
Specified a policy for garbage collecting containers.
type DiskSpacePolicy ¶ added in v0.18.0
type HostInterface ¶
type HostInterface interface {
GetContainerInfo(podFullName string, uid types.UID, containerName string, req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)
GetContainerRuntimeVersion() (kubecontainer.Version, error)
GetRawContainerInfo(containerName string, req *cadvisorApi.ContainerInfoRequest, subcontainers bool) (map[string]*cadvisorApi.ContainerInfo, error)
GetCachedMachineInfo() (*cadvisorApi.MachineInfo, error)
GetPods() []*api.Pod
GetRunningPods() ([]*api.Pod, error)
GetPodByName(namespace, name string) (*api.Pod, bool)
RunInContainer(name string, uid types.UID, container string, cmd []string) ([]byte, error)
ExecInContainer(name string, uid types.UID, container string, cmd []string, in io.Reader, out, err io.WriteCloser, tty bool) error
AttachContainer(name string, uid types.UID, container string, in io.Reader, out, err io.WriteCloser, tty bool) error
GetKubeletContainerLogs(podFullName, containerName string, logOptions *api.PodLogOptions, stdout, stderr io.Writer) error
ServeLogs(w http.ResponseWriter, req *http.