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
- func GetPhase(spec *v1.PodSpec, info []v1.ContainerStatus) v1.PodPhase
- func NewInitializedVolumePluginMgr(kubelet *Kubelet, secretManager secret.Manager, ...) (*volume.VolumePluginMgr, error)
- type Bootstrap
- type Builder
- type Dependencies
- type KillPodOptions
- 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) GeneratePodHostNameAndDomain(pod *v1.Pod) (string, string, error)
- func (kl *Kubelet) GenerateRunContainerOptions(pod *v1.Pod, container *v1.Container, podIP string) (*kubecontainer.RunContainerOptions, bool, error)
- func (kl *Kubelet) GetActivePods() []*v1.Pod
- func (kl *Kubelet) GetAttach(podFullName string, podUID types.UID, containerName string, ...) (*url.URL, error)
- func (kl *Kubelet) GetCachedMachineInfo() (*cadvisorapi.MachineInfo, error)
- func (kl *Kubelet) GetCachedRootFsInfo() (cadvisorapiv2.FsInfo, error)
- func (kl *Kubelet) GetClusterDNS(pod *v1.Pod) ([]string, []string, bool, error)
- func (kl *Kubelet) GetConfiguration() kubeletconfiginternal.KubeletConfiguration
- func (kl *Kubelet) GetContainerInfo(podFullName string, podUID types.UID, containerName string, ...) (*cadvisorapi.ContainerInfo, error)
- func (kl *Kubelet) GetContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error)
- func (kl *Kubelet) GetExec(podFullName string, podUID types.UID, containerName string, cmd []string, ...) (*url.URL, error)
- func (kl *Kubelet) GetExtraSupplementalGroupsForPod(pod *v1.Pod) []int64
- func (kl *Kubelet) GetHostIP() (net.IP, error)
- func (kl *Kubelet) GetHostname() string
- func (kl *Kubelet) GetKubeClient() clientset.Interface
- func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName string, logOptions *v1.PodLogOptions, ...) error
- func (kl *Kubelet) GetNode() (*v1.Node, error)
- func (kl *Kubelet) GetNodeConfig() cm.NodeConfig
- func (kl *Kubelet) GetPodByFullName(podFullName string) (*v1.Pod, bool)
- func (kl *Kubelet) GetPodByName(namespace, name string) (*v1.Pod, bool)
- func (kl *Kubelet) GetPodCgroupParent(pod *v1.Pod) string
- func (kl *Kubelet) GetPodDir(podUID types.UID) string
- func (kl *Kubelet) GetPods() []*v1.Pod
- func (kl *Kubelet) GetPortForward(podName, podNamespace string, podUID types.UID, ...) (*url.URL, error)
- func (kl *Kubelet) GetRawContainerInfo(containerName string, req *cadvisorapi.ContainerInfoRequest, ...) (map[string]*cadvisorapi.ContainerInfo, error)
- func (kl *Kubelet) GetRunningPods() ([]*v1.Pod, error)
- func (kl *Kubelet) GetRuntime() kubecontainer.Runtime
- func (kl *Kubelet) GetVersionInfo() (*cadvisorapi.VersionInfo, error)
- func (kl *Kubelet) HandlePodAdditions(pods []*v1.Pod)
- func (kl *Kubelet) HandlePodCleanups() error
- func (kl *Kubelet) HandlePodReconcile(pods []*v1.Pod)
- func (kl *Kubelet) HandlePodRemoves(pods []*v1.Pod)
- func (kl *Kubelet) HandlePodSyncs(pods []*v1.Pod)
- func (kl *Kubelet) HandlePodUpdates(pods []*v1.Pod)
- func (kl *Kubelet) ImagesFsInfo() (cadvisorapiv2.FsInfo, error)
- func (kl *Kubelet) LatestLoopEntryTime() time.Time
- func (kl *Kubelet) ListVolumesForPod(podUID types.UID) (map[string]volume.Volume, bool)
- func (kl *Kubelet) ListenAndServe(address net.IP, port uint, tlsOptions *server.TLSOptions, ...)
- func (kl *Kubelet) ListenAndServeReadOnly(address net.IP, port uint)
- func (kl *Kubelet) PodResourcesAreReclaimed(pod *v1.Pod, status v1.PodStatus) bool
- func (kl *Kubelet) PortForward(podFullName string, podUID types.UID, port int32, stream io.ReadWriteCloser) error
- func (kl *Kubelet) ResyncInterval() time.Duration
- func (kl *Kubelet) RootFsInfo() (cadvisorapiv2.FsInfo, error)
- func (kl *Kubelet) Run(updates <-chan kubetypes.PodUpdate)
- func (kl *Kubelet) RunInContainer(podFullName string, podUID types.UID, containerName string, cmd []string) ([]byte, error)
- func (kl *Kubelet) RunOnce(updates <-chan kubetypes.PodUpdate) ([]RunPodResult, error)
- func (kl *Kubelet) ServeLogs(w http.ResponseWriter, req *http.Request)
- func (kl *Kubelet) StartGarbageCollection()
- func (kl *Kubelet) StreamingConnectionIdleTimeout() time.Duration
- type NoOpLegacyHost
- type OOMWatcher
- type OnCompleteFunc
- type Option
- type PodStatusFunc
- type PodWorkers
- type ReasonCache
- type RunPodResult
- type SyncHandler
- type UpdatePodOptions
Constants ¶
const ( // ContainerLogsDir is the location of container logs. ContainerLogsDir = "/var/log/containers" // MaxContainerBackOff is the max backoff period, exported for the e2e test MaxContainerBackOff = 300 * time.Second // ContainerGCPeriod is the period for performing container garbage collection. ContainerGCPeriod = time.Minute // ImageGCPeriod is the period for performing image garbage collection. ImageGCPeriod = 5 * time.Minute )
const ( // KubeMarkMasqChain is the mark-for-masquerade chain // TODO: clean up this logic in kube-proxy KubeMarkMasqChain utiliptables.Chain = "KUBE-MARK-MASQ" // KubeMarkDropChain is the mark-for-drop chain KubeMarkDropChain utiliptables.Chain = "KUBE-MARK-DROP" // KubePostroutingChain is kubernetes postrouting rules KubePostroutingChain utiliptables.Chain = "KUBE-POSTROUTING" // KubeFirewallChain is kubernetes firewall rules KubeFirewallChain utiliptables.Chain = "KUBE-FIREWALL" )
Variables ¶
This section is empty.
Functions ¶
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 NewInitializedVolumePluginMgr ¶ added in v1.3.0
func NewInitializedVolumePluginMgr( kubelet *Kubelet, secretManager secret.Manager, configMapManager configmap.Manager, plugins []volume.VolumePlugin) (*volume.VolumePluginMgr, error)
NewInitializedVolumePluginMgr returns a new instance of volume.VolumePluginMgr initialized with kubelets implementation of the volume.VolumeHost interface.
kubelet - used by VolumeHost methods to expose kubelet specific parameters plugins - used to initialize volumePluginMgr
Types ¶
type Bootstrap ¶ added in v1.8.0
type Bootstrap interface { GetConfiguration() kubeletconfiginternal.KubeletConfiguration BirthCry() StartGarbageCollection() ListenAndServe(address net.IP, port uint, tlsOptions *server.TLSOptions, auth server.AuthInterface, enableDebuggingHandlers, enableContentionProfiling bool) ListenAndServeReadOnly(address net.IP, port uint) Run(<-chan kubetypes.PodUpdate) RunOnce(<-chan kubetypes.PodUpdate) ([]RunPodResult, error) }
Bootstrap is a bootstrapping interface for kubelet, targets the initialization protocol
type Builder ¶ added in v1.8.0
type Builder func(kubeCfg *kubeletconfiginternal.KubeletConfiguration, kubeDeps *Dependencies, crOptions *options.ContainerRuntimeOptions, hostnameOverride, nodeIP, providerID, cloudProvider, certDirectory, rootDirectory string) (Bootstrap, error)
Builder creates and initializes a Kubelet instance
type Dependencies ¶ added in v1.8.0
type Dependencies struct { // TODO(mtaufen): KubeletBuilder: // Mesos currently uses this as a hook to let them make their own call to // let them wrap the KubeletBootstrap that CreateAndInitKubelet returns with // their own KubeletBootstrap. It's a useful hook. I need to think about what // a nice home for it would be. There seems to be a trend, between this and // the Options fields below, of providing hooks where you can add extra functionality // to the Kubelet for your solution. Maybe we should centralize these sorts of things? Builder Builder // TODO(mtaufen): ContainerRuntimeOptions and Options: // Arrays of functions that can do arbitrary things to the Kubelet and the Runtime // seem like a difficult path to trace when it's time to debug something. // I'm leaving these fields here for now, but there is likely an easier-to-follow // way to support their intended use cases. E.g. ContainerRuntimeOptions // is used by Mesos to set an environment variable in containers which has // some connection to their container GC. It seems that Mesos intends to use // Options to add additional node conditions that are updated as part of the // Kubelet lifecycle (see https://github.com/kubernetes/kubernetes/pull/21521). // We should think about providing more explicit ways of doing these things. ContainerRuntimeOptions []kubecontainer.Option Options []Option // Injected Dependencies Auth server.AuthInterface CAdvisorInterface cadvisor.Interface Cloud cloudprovider.Interface ContainerManager cm.ContainerManager DockerClient libdocker.Interface EventClient v1core.EventsGetter KubeClient clientset.Interface ExternalKubeClient clientgoclientset.Interface Mounter mount.Interface NetworkPlugins []network.NetworkPlugin OOMAdjuster *oom.OOMAdjuster OSInterface kubecontainer.OSInterface PodConfig *config.PodConfig Recorder record.EventRecorder Writer kubeio.Writer VolumePlugins []volume.VolumePlugin TLSOptions *server.TLSOptions KubeletConfigController *kubeletconfig.Controller }
Dependencies is a bin for things we might consider "injected dependencies" -- objects constructed at runtime that are necessary for running the Kubelet. This is a temporary solution for grouping these objects while we figure out a more comprehensive dependency injection story for the Kubelet.
type KillPodOptions ¶ added in v1.3.0
type KillPodOptions struct { // PodStatusFunc is the function to invoke to set pod status in response to a kill request. PodStatusFunc PodStatusFunc // PodTerminationGracePeriodSecondsOverride is optional override to use if a pod is being killed as part of kill operation. PodTerminationGracePeriodSecondsOverride *int64 }
KillPodOptions are options when performing a pod update whose update type is kill.
type Kubelet ¶
type Kubelet struct { // the list of handlers to call during pod sync loop. lifecycle.PodSyncLoopHandlers // the list of handlers to call during pod sync. lifecycle.PodSyncHandlers // contains filtered or unexported fields }
Kubelet is the main kubelet implementation.
func NewMainKubelet ¶
func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration, kubeDeps *Dependencies, crOptions *options.ContainerRuntimeOptions, hostnameOverride, nodeIP, providerID, cloudProvider, certDirectory, rootDirectory string) (*Kubelet, error)
NewMainKubelet instantiates a new Kubelet object along with all the required internal modules. No initialization of Kubelet and its modules should happen here.
func (*Kubelet) AttachContainer ¶ added in v1.1.0
func (kl *Kubelet) AttachContainer(podFullName string, podUID types.UID, containerName string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error
AttachContainer uses the container runtime to attach the given streams to the given container.
func (*Kubelet) BirthCry ¶ added in v0.5.1
func (kl *Kubelet) BirthCry()
BirthCry sends an event that the kubelet has started up.
func (*Kubelet) ExecInContainer ¶ added in v0.12.0
func (kl *Kubelet) ExecInContainer(podFullName string, podUID types.UID, containerName string, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error
ExecInContainer executes a command in a container, connecting the supplied stdin/stdout/stderr to the command's IO streams.
func (*Kubelet) GeneratePodHostNameAndDomain ¶ added in v1.3.0
GeneratePodHostNameAndDomain creates a hostname and domain name for a pod, given that pod's spec and annotations or returns an error.
func (*Kubelet) GenerateRunContainerOptions ¶ added in v0.16.0
func (kl *Kubelet) GenerateRunContainerOptions(pod *v1.Pod, container *v1.Container, podIP string) (*kubecontainer.RunContainerOptions, bool, error)
GenerateRunContainerOptions generates the RunContainerOptions, which can be used by the container runtime to set parameters for launching a container.
func (*Kubelet) GetActivePods ¶ added in v1.6.0
GetActivePods returns non-terminal pods
func (*Kubelet) GetAttach ¶ added in v1.5.0
func (kl *Kubelet) GetAttach(podFullName string, podUID types.UID, containerName string, streamOpts remotecommandserver.Options) (*url.URL, error)
GetAttach gets the URL the attach will be served from, or nil if the Kubelet will serve it.
func (*Kubelet) GetCachedMachineInfo ¶ added in v0.14.0
func (kl *Kubelet) GetCachedMachineInfo() (*cadvisorapi.MachineInfo, error)
GetCachedMachineInfo assumes that the machine info can't change without a reboot
func (*Kubelet) GetCachedRootFsInfo ¶ added in v1.7.0
func (kl *Kubelet) GetCachedRootFsInfo() (cadvisorapiv2.FsInfo, error)
GetCachedRootFsInfo assumes that the rootfs info can't change without a reboot
func (*Kubelet) GetClusterDNS ¶ added in v1.2.0
GetClusterDNS returns a list of the DNS servers and a list of the DNS search domains of the cluster.
func (*Kubelet) GetConfiguration ¶ added in v1.4.0
func (kl *Kubelet) GetConfiguration() kubeletconfiginternal.KubeletConfiguration
GetConfiguration returns the KubeletConfiguration used to configure the kubelet.
func (*Kubelet) GetContainerInfo ¶
func (kl *Kubelet) GetContainerInfo(podFullName string, podUID types.UID, containerName string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
GetContainerInfo returns stats (from Cadvisor) for a container.
func (*Kubelet) GetContainerInfoV2 ¶ added in v1.2.0
func (kl *Kubelet) GetContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error)
GetContainerInfoV2 returns stats (from Cadvisor) for containers.
func (*Kubelet) GetExec ¶ added in v1.5.0
func (kl *Kubelet) GetExec(podFullName string, podUID types.UID, containerName string, cmd []string, streamOpts remotecommandserver.Options) (*url.URL, error)
GetExec gets the URL the exec will be served from, or nil if the Kubelet will serve it.
func (*Kubelet) GetExtraSupplementalGroupsForPod ¶ added in v1.4.0
GetExtraSupplementalGroupsForPod returns a list of the extra supplemental groups for the Pod. These extra supplemental groups come from annotations on persistent volumes that the pod depends on.
func (*Kubelet) GetHostname ¶ added in v0.12.0
GetHostname Returns the hostname as the kubelet sees it.
func (*Kubelet) GetKubeClient ¶ added in v1.5.0
GetKubeClient returns the Kubernetes client. TODO: This is currently only required by network plugins. Replace with more specific methods.
func (*Kubelet) GetKubeletContainerLogs ¶
func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName string, logOptions *v1.PodLogOptions, stdout, stderr io.Writer) error
GetKubeletContainerLogs returns logs from the container TODO: this method is returning logs of random container attempts, when it should be returning the most recent attempt or all of them.
func (*Kubelet) GetNode ¶ added in v0.14.0
GetNode returns the node info for the configured node name of this Kubelet.
func (*Kubelet) GetNodeConfig ¶ added in v1.2.0
func (kl *Kubelet) GetNodeConfig() cm.NodeConfig
GetNodeConfig returns the container manager node config.
func (*Kubelet) GetPodByFullName ¶ added in v0.12.0
GetPodByFullName gets the pod with the given 'full' name, which incorporates the namespace as well as whether the pod was found.
func (*Kubelet) GetPodByName ¶ added in v0.9.0
GetPodByName provides the first pod that matches namespace and name, as well as whether the pod was found.
func (*Kubelet) GetPodCgroupParent ¶ added in v1.6.0
GetPodCgroupParent gets pod cgroup parent from container manager.
func (*Kubelet) GetPodDir ¶ added in v0.7.0
GetPodDir returns the full path to the per-pod data directory for the specified pod. This directory may not exist if the pod does not exist.
func (*Kubelet) GetPods ¶ added in v0.13.1
GetPods returns all pods bound to the kubelet and their spec, and the mirror pods.
func (*Kubelet) GetPortForward ¶ added in v1.5.0
func (kl *Kubelet) GetPortForward(podName, podNamespace string, podUID types.UID, portForwardOpts portforward.V4Options) (*url.URL, error)
GetPortForward gets the URL the port-forward will be served from, or nil if the Kubelet will serve it.
func (*Kubelet) GetRawContainerInfo ¶ added in v0.16.0
func (kl *Kubelet) GetRawContainerInfo(containerName string, req *cadvisorapi.ContainerInfoRequest, subcontainers bool) (map[string]*cadvisorapi.ContainerInfo, error)
GetRawContainerInfo returns stats (from Cadvisor) for a non-Kubernetes container.
func (*Kubelet) GetRunningPods ¶ added in v0.21.0
GetRunningPods returns all pods running on kubelet from looking at the container runtime cache. This function converts kubecontainer.Pod to v1.Pod, so only the fields that exist in both kubecontainer.Pod and v1.Pod are considered meaningful.
func (*Kubelet) GetRuntime ¶ added in v0.19.0
func (kl *Kubelet) GetRuntime() kubecontainer.Runtime
GetRuntime returns the current Runtime implementation in use by the kubelet. This func is exported to simplify integration with third party kubelet extensions (e.g. kubernetes-mesos).
func (*Kubelet) GetVersionInfo ¶ added in v1.7.3
func (kl *Kubelet) GetVersionInfo() (*cadvisorapi.VersionInfo, error)
GetVersionInfo returns information about the version of cAdvisor in use.
func (*Kubelet) HandlePodAdditions ¶ added in v1.1.0
HandlePodAdditions is the callback in SyncHandler for pods being added from a config source.
func (*Kubelet) HandlePodCleanups ¶ added in v1.1.0
HandlePodCleanups performs a series of cleanup work, including terminating pod workers, killing unwanted pods, and removing orphaned volumes/pod directories. NOTE: This function is executed by the main sync loop, so it should not contain any blocking calls.
func (*Kubelet) HandlePodReconcile ¶ added in v1.2.0
HandlePodReconcile is the callback in the SyncHandler interface for pods that should be reconciled.
func (*Kubelet) HandlePodRemoves ¶ added in v1.4.0
HandlePodRemoves is the callback in the SyncHandler interface for pods being removed from a config source.
func (*Kubelet) HandlePodSyncs ¶ added in v1.1.0
HandlePodSyncs is the callback in the syncHandler interface for pods that should be dispatched to pod workers for sync.
func (*Kubelet) HandlePodUpdates ¶ added in v1.1.0
HandlePodUpdates is the callback in the SyncHandler interface for pods being updated from a config source.
func (*Kubelet) ImagesFsInfo ¶ added in v1.3.0
func (kl *Kubelet) ImagesFsInfo() (cadvisorapiv2.FsInfo, error)
ImagesFsInfo returns information about docker image fs usage from cadvisor.
func (*Kubelet) LatestLoopEntryTime ¶ added in v0.20.0
LatestLoopEntryTime returns the last time in the sync loop monitor.
func (*Kubelet) ListVolumesForPod ¶ added in v1.2.0
ListVolumesForPod returns a map of the mounted volumes for the given pod. The key in the map is the OuterVolumeSpecName (i.e. pod.Spec.Volumes[x].Name)
func (*Kubelet) ListenAndServe ¶ added in v0.15.0
func (kl *Kubelet) ListenAndServe(address net.IP, port uint, tlsOptions *server.TLSOptions, auth server.AuthInterface, enableDebuggingHandlers, enableContentionProfiling bool)
ListenAndServe runs the kubelet HTTP server.
func (*Kubelet) ListenAndServeReadOnly ¶ added in v0.15.0
ListenAndServeReadOnly runs the kubelet HTTP server in read-only mode.
func (*Kubelet) PodResourcesAreReclaimed ¶ added in v1.7.0
PodResourcesAreReclaimed returns true if all required node-level resources that a pod was consuming have been reclaimed by the kubelet. Reclaiming resources is a prerequisite to deleting a pod from the API server.
func (*Kubelet) PortForward ¶ added in v0.12.0
func (kl *Kubelet) PortForward(podFullName string, podUID types.UID, port int32, stream io.ReadWriteCloser) error
PortForward connects to the pod's port and copies data between the port and the stream.
func (*Kubelet) ResyncInterval ¶ added in v0.20.0
ResyncInterval returns the interval used for periodic syncs.
func (*Kubelet) RootFsInfo ¶ added in v1.2.0
func (kl *Kubelet) RootFsInfo() (cadvisorapiv2.FsInfo, error)
RootFsInfo returns info about the root fs from cadvisor.
func (*Kubelet) RunInContainer ¶
func (kl *Kubelet) RunInContainer(podFullName string, podUID types.UID, containerName string, cmd []string) ([]byte, error)
RunInContainer runs a command in a container, returns the combined stdout, stderr as an array of bytes
func (*Kubelet) RunOnce ¶
func (kl *Kubelet) RunOnce(updates <-chan kubetypes.PodUpdate) ([]RunPodResult, error)
RunOnce polls from one configuration update and run the associated pods.
func (*Kubelet) ServeLogs ¶
func (kl *Kubelet) ServeLogs(w http.ResponseWriter, req *http.Request)
ServeLogs returns logs of current machine.
func (*Kubelet) StartGarbageCollection ¶ added in v0.14.0
func (kl *Kubelet) StartGarbageCollection()
StartGarbageCollection starts garbage collection threads.
func (*Kubelet) StreamingConnectionIdleTimeout ¶ added in v0.12.0
StreamingConnectionIdleTimeout returns the timeout for streaming connections to the HTTP server.
type NoOpLegacyHost ¶ added in v1.7.0
type NoOpLegacyHost struct{}
NoOpLegacyHost implements the network.LegacyHost interface for the remote runtime shim by just returning empties. It doesn't support legacy features like host port and bandwidth shaping.
func (*NoOpLegacyHost) GetKubeClient ¶ added in v1.7.0
func (n *NoOpLegacyHost) GetKubeClient() clientset.Interface
GetKubeClient always returns "nil" for 'NoOpLegacyHost'
func (*NoOpLegacyHost) GetPodByName ¶ added in v1.7.0
func (n *NoOpLegacyHost) GetPodByName(namespace, name string) (*v1.Pod, bool)
GetPodByName always returns "nil, true" for 'NoOpLegacyHost'
func (*NoOpLegacyHost) GetRuntime ¶ added in v1.7.0
func (n *NoOpLegacyHost) GetRuntime() kubecontainer.Runtime
GetRuntime always returns "nil" for 'NoOpLegacyHost'
func (*NoOpLegacyHost) SupportsLegacyFeatures ¶ added in v1.7.0
func (n *NoOpLegacyHost) SupportsLegacyFeatures() bool
SupportsLegacyFeatures always returns "false" for 'NoOpLegacyHost'
type OOMWatcher ¶ added in v0.17.0
type OOMWatcher interface {
Start(ref *v1.ObjectReference) error
}
OOMWatcher defines the interface of OOM watchers.
func NewOOMWatcher ¶ added in v0.17.0
func NewOOMWatcher(cadvisor cadvisor.Interface, recorder record.EventRecorder) OOMWatcher
NewOOMWatcher creates and initializes a OOMWatcher based on parameters.
type OnCompleteFunc ¶ added in v1.3.0
type OnCompleteFunc func(err error)
OnCompleteFunc is a function that is invoked when an operation completes. If err is non-nil, the operation did not complete successfully.
type Option ¶ added in v1.2.0
type Option func(*Kubelet)
Option is a functional option type for Kubelet
type PodStatusFunc ¶ added in v1.3.0
PodStatusFunc is a function that is invoked to generate a pod status.
type PodWorkers ¶ added in v0.17.0
type PodWorkers interface { UpdatePod(options *UpdatePodOptions) ForgetNonExistingPodWorkers(desiredPods map[types.UID]empty) ForgetWorker(uid types.UID) }
PodWorkers is an abstract interface for testability.
type ReasonCache ¶ added in v1.2.0
type ReasonCache struct {
// contains filtered or unexported fields
}
ReasonCache stores the failure reason of the latest container start in a string, keyed by <pod_UID>_<container_name>. The goal is to propagate this reason to the container status. This endeavor is "best-effort" for two reasons:
- The cache is not persisted.
- We use an LRU cache to avoid extra garbage collection work. This means that some entries may be recycled before a pod has been deleted.
TODO(random-liu): Use more reliable cache which could collect garbage of failed pod. TODO(random-liu): Move reason cache to somewhere better.
func NewReasonCache ¶ added in v1.2.0
func NewReasonCache() *ReasonCache
NewReasonCache creates an instance of 'ReasonCache'.
func (*ReasonCache) Get ¶ added in v1.2.0
func (c *ReasonCache) Get(uid types.UID, name string) (*reasonItem, bool)
Get gets error reason from the cache. The return values are error reason, error message and whether an error reason is found in the cache. If no error reason is found, empty string will be returned for error reason and error message.
func (*ReasonCache) Remove ¶ added in v1.2.0
func (c *ReasonCache) Remove(uid types.UID, name string)
Remove removes error reason from the cache
func (*ReasonCache) Update ¶ added in v1.2.0
func (c *ReasonCache) Update(uid types.UID, result kubecontainer.PodSyncResult)
Update updates the reason cache with the SyncPodResult. Only SyncResult with StartContainer action will change the cache.
type RunPodResult ¶
RunPodResult defines the running results of a Pod.
type SyncHandler ¶
type SyncHandler interface { HandlePodAdditions(pods []*v1.Pod) HandlePodUpdates(pods []*v1.Pod) HandlePodRemoves(pods []*v1.Pod) HandlePodReconcile(pods []*v1.Pod) HandlePodSyncs(pods []*v1.Pod) HandlePodCleanups() error }
SyncHandler is an interface implemented by Kubelet, for testability
type UpdatePodOptions ¶ added in v1.3.0
type UpdatePodOptions struct { // pod to update Pod *v1.Pod // the mirror pod for the pod to update, if it is a static pod MirrorPod *v1.Pod // the type of update (create, update, sync, kill) UpdateType kubetypes.SyncPodType // optional callback function when operation completes // this callback is not guaranteed to be completed since a pod worker may // drop update requests if it was fulfilling a previous request. this is // only guaranteed to be invoked in response to a kill pod request which is // always delivered. OnCompleteFunc OnCompleteFunc // if update type is kill, use the specified options to kill the pod. KillPodOptions *KillPodOptions }
UpdatePodOptions is an options struct to pass to a UpdatePod operation.
Source Files ¶
- active_deadline.go
- doc.go
- kubelet.go
- kubelet_cadvisor.go
- kubelet_getters.go
- kubelet_network.go
- kubelet_node_status.go
- kubelet_pods.go
- kubelet_resources.go
- kubelet_volumes.go
- networks.go
- oom_watcher.go
- pod_container_deletor.go
- pod_workers.go
- reason_cache.go
- runonce.go
- runtime.go
- util.go
- volume_host.go
Directories ¶
Path | Synopsis |
---|---|
cri/v1alpha1/runtime
Package runtime is a generated protocol buffer package.
|
Package runtime is a generated protocol buffer package. |
deviceplugin/v1alpha1
Package deviceplugin is a generated protocol buffer package.
|
Package deviceplugin is a generated protocol buffer package. |
Kubelet interactions with cAdvisor.
|
Kubelet interactions with cAdvisor. |
Reads the pod configuration from the Kubernetes apiserver.
|
Reads the pod configuration from the Kubernetes apiserver. |
Package custommetrics contains support for instrumenting cAdvisor to gather custom metrics from pods.
|
Package custommetrics contains support for instrumenting cAdvisor to gather custom metrics from pods. |
Docker integration using pkg/kubelet/apis/cri/v1alpha1/runtime/api.pb.go
|
Docker integration using pkg/kubelet/apis/cri/v1alpha1/runtime/api.pb.go |
Package envvars is the package that build the environment variables that kubernetes provides to the containers run by it.
|
Package envvars is the package that build the environment variables that kubernetes provides to the containers run by it. |
Package eviction is responsible for enforcing eviction thresholds to maintain node stability.
|
Package eviction is responsible for enforcing eviction thresholds to maintain node stability. |
Package images is responsible for managing lifecycle of container images.
|
Package images is responsible for managing lifecycle of container images. |
Package kuberuntime contains an implementation of kubecontainer.Runtime using the interface in pkg/kubelet/v1.
|
Package kuberuntime contains an implementation of kubecontainer.Runtime using the interface in pkg/kubelet/v1. |
Package leaky holds bits of kubelet that should be internal but have leaked out through bad abstractions.
|
Package leaky holds bits of kubelet that should be internal but have leaked out through bad abstractions. |
Handlers for pod lifecycle events and interfaces to integrate with kubelet admission, synchronization, and eviction of pods.
|
Handlers for pod lifecycle events and interfaces to integrate with kubelet admission, synchronization, and eviction of pods. |
cni/testing
mock_cni is a mock of the `libcni.CNI` interface.
|
mock_cni is a mock of the `libcni.CNI` interface. |
Package pleg contains types and a generic implementation of the pod lifecycle event generator.
|
Package pleg contains types and a generic implementation of the pod lifecycle event generator. |
package qos contains helper functions for quality of service.
|
package qos contains helper functions for quality of service. |
Package remote containers gRPC implementation of internalapi.RuntimeService and internalapi.ImageManagerService.
|
Package remote containers gRPC implementation of internalapi.RuntimeService and internalapi.ImageManagerService. |
Package rkt contains the Containerruntime interface implementation for rkt.
|
Package rkt contains the Containerruntime interface implementation for rkt. |
Package rktshim is the package that contains the shim code for rkt to be used as the kubelet container runtime implementation that is integrated using the Container Runtime Interface.
|
Package rktshim is the package that contains the shim code for rkt to be used as the kubelet container runtime implementation that is integrated using the Container Runtime Interface. |
Package server contains functions related to serving Kubelet's external interface.
|
Package server contains functions related to serving Kubelet's external interface. |
portforward
package portforward contains server-side logic for handling port forwarding requests.
|
package portforward contains server-side logic for handling port forwarding requests. |
remotecommand
package remotecommand contains functions related to executing commands in and attaching to pods.
|
package remotecommand contains functions related to executing commands in and attaching to pods. |
stats
Package stats handles exporting Kubelet and container stats.
|
Package stats handles exporting Kubelet and container stats. |
Common types in the Kubelet.
|
Common types in the Kubelet. |
Utility functions.
|
Utility functions. |
cache
Package cache implements data structures used by the kubelet volume manager to keep track of attached volumes and the pods that mounted them.
|
Package cache implements data structures used by the kubelet volume manager to keep track of attached volumes and the pods that mounted them. |
populator
Package populator implements interfaces that monitor and keep the states of the caches in sync with the "ground truth".
|
Package populator implements interfaces that monitor and keep the states of the caches in sync with the "ground truth". |
reconciler
Package reconciler implements interfaces that attempt to reconcile the desired state of the with the actual state of the world by triggering relevant actions (attach, detach, mount, unmount).
|
Package reconciler implements interfaces that attempt to reconcile the desired state of the with the actual state of the world by triggering relevant actions (attach, detach, mount, unmount). |