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 GetPodFullName(pod *Pod) string
- func ListenAndServeKubeletServer(host HostInterface, updates chan<- interface{}, address net.IP, port uint, ...)
- func ResolvePort(portReference util.IntOrString, container *api.Container) (int, error)
- func ValidatePod(pod *Pod) (errors []error)
- type ByCreated
- type CadvisorInterface
- type FlushWriter
- type HostInterface
- type Kubelet
- func (kl *Kubelet) GarbageCollectContainers() error
- func (kl *Kubelet) GetCadvisorClient() CadvisorInterface
- func (kl *Kubelet) GetContainerInfo(podFullName, uuid, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
- func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName, tail string, follow bool, stdout, stderr io.Writer) error
- func (kl *Kubelet) GetMachineInfo() (*info.MachineInfo, error)
- func (kl *Kubelet) GetPodInfo(podFullName, uuid string) (api.PodInfo, error)
- func (kl *Kubelet) GetRootInfo(req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
- func (kl *Kubelet) LogEvent(event *api.Event) error
- func (kl *Kubelet) Run(updates <-chan PodUpdate)
- func (kl *Kubelet) RunInContainer(podFullName, uuid, container 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) SetCadvisorClient(c CadvisorInterface)
- func (kl *Kubelet) SyncPods(pods []Pod) error
- type Pod
- type PodOperation
- type PodUpdate
- type RunPodResult
- type Server
- type SyncHandler
Constants ¶
const ( RunOnceManifestDelay = 1 * time.Second RunOnceMaxRetries = 10 RunOnceRetryDelay = 1 * time.Second RunOnceRetryDelayBackoff = 2 )
const (
NetworkContainerImage = "kubernetes/pause:latest"
)
Variables ¶
This section is empty.
Functions ¶
func GetPodFullName ¶
GetPodFullName returns a name that full identifies a pod across all config sources.
func ListenAndServeKubeletServer ¶
func ListenAndServeKubeletServer(host HostInterface, updates chan<- interface{}, address net.IP, port uint, enableDebuggingHandlers bool)
ListenAndServeKubeletServer initializes a server to respond to HTTP network requests on the Kubelet.
func ResolvePort ¶
ResolvePort attempts to turn a IntOrString port reference into a concrete port number. If portReference has an int value, it is treated as a literal, and simply returns that value. If portReference is a string, an attempt is first made to parse it as an integer. If that fails, an attempt is made to find a port with the same name in the container spec. If a port with the same name is found, it's ContainerPort value is returned. If no matching port is found, an error is returned.
func ValidatePod ¶
Types ¶
type CadvisorInterface ¶
type CadvisorInterface interface { ContainerInfo(name string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) MachineInfo() (*info.MachineInfo, error) }
CadvisorInterface is an abstract interface for testability. It abstracts the interface of "github.com/google/cadvisor/client".Client.
type FlushWriter ¶
type FlushWriter struct {
// contains filtered or unexported fields
}
FlushWriter provides wrapper for responseWriter with HTTP streaming capabilities
type HostInterface ¶
type HostInterface interface { GetContainerInfo(podFullName, uuid, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) GetRootInfo(req *info.ContainerInfoRequest) (*info.ContainerInfo, error) GetMachineInfo() (*info.MachineInfo, error) GetPodInfo(name, uuid string) (api.PodInfo, error) RunInContainer(name, uuid, container string, cmd []string) ([]byte, error) GetKubeletContainerLogs(podFullName, containerName, tail string, follow bool, stdout, stderr io.Writer) error ServeLogs(w http.ResponseWriter, req *http.Request) }
HostInterface contains all the kubelet methods required by the server. For testablitiy.
type Kubelet ¶
type Kubelet struct {
// contains filtered or unexported fields
}
Kubelet is the main kubelet implementation.
func NewIntegrationTestKubelet ¶
func NewIntegrationTestKubelet(hn string, rd string, dc dockertools.DockerInterface) *Kubelet
NewIntegrationTestKubelet creates a new Kubelet for use in integration tests. TODO: add more integration tests, and expand parameter list as needed.
func NewMainKubelet ¶
func NewMainKubelet( hn string, dc dockertools.DockerInterface, ec tools.EtcdClient, rd string, ni string, ri time.Duration, pullQPS float32, pullBurst int, minimumGCAge time.Duration, maxContainerCount int) *Kubelet
New creates a new Kubelet for use in main
func (*Kubelet) GarbageCollectContainers ¶ added in v0.4.2
TODO: Also enforce a maximum total number of containers.
func (*Kubelet) GetCadvisorClient ¶
func (kl *Kubelet) GetCadvisorClient() CadvisorInterface
GetCadvisorClient gets the cadvisor client.
func (*Kubelet) GetContainerInfo ¶
func (kl *Kubelet) GetContainerInfo(podFullName, uuid, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetContainerInfo returns stats (from Cadvisor) for a container.
func (*Kubelet) GetKubeletContainerLogs ¶
func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName, tail string, follow bool, stdout, stderr io.Writer) error
GetKubeletContainerLogs returns logs from the container The second parameter of GetPodInfo and FindPodContainer methods represents pod UUID, which is allowed to be blank
func (*Kubelet) GetMachineInfo ¶
func (kl *Kubelet) GetMachineInfo() (*info.MachineInfo, error)
func (*Kubelet) GetPodInfo ¶
GetPodInfo returns information from Docker about the containers in a pod
func (*Kubelet) GetRootInfo ¶
func (kl *Kubelet) GetRootInfo(req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetRootInfo returns stats (from Cadvisor) of current machine (root container).
func (*Kubelet) RunInContainer ¶
func (kl *Kubelet) RunInContainer(podFullName, uuid, container string, cmd []string) ([]byte, error)
Run a command in a container, returns the combined stdout, stderr as an array of bytes
func (*Kubelet) RunOnce ¶
func (kl *Kubelet) RunOnce(updates <-chan 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)
Returns logs of current machine.
func (*Kubelet) SetCadvisorClient ¶
func (kl *Kubelet) SetCadvisorClient(c CadvisorInterface)
SetCadvisorClient sets the cadvisor client in a thread-safe way.
type Pod ¶
type Pod struct { Namespace string Name string Manifest api.ContainerManifest }
Pod represents the structure of a pod on the Kubelet, distinct from the apiserver representation of a Pod.
type PodOperation ¶
type PodOperation int
PodOperation defines what changes will be made on a pod configuration.
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 )
type PodUpdate ¶
type PodUpdate struct { Pods []Pod Op PodOperation }
PodUpdate defines an operation sent on the channel. You can add or remove single services by sending an array of size one and Op == ADD|REMOVE (with REMOVE, only the ID is required). For setting the state of the system to a given state for this source configuration, set Pods as desired and Op to SET, which will reset the system state to that specified in this operation for this source channel. To remove all pods, set Pods to empty array and Op to SET.
type RunPodResult ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a http.Handler which exposes kubelet functionality over HTTP.
func NewServer ¶
func NewServer(host HostInterface, updates chan<- interface{}, enableDebuggingHandlers bool) Server
NewServer initializes and configures a kubelet.Server object to handle HTTP requests.
func (*Server) InstallDebuggingHandlers ¶
func (s *Server) InstallDebuggingHandlers()
InstallDeguggingHandlers registers the HTTP request patterns that serve logs or run commands/containers
func (*Server) InstallDefaultHandlers ¶
func (s *Server) InstallDefaultHandlers()
InstallDefaultHandlers registers the default set of supported HTTP request patterns with the mux.
type SyncHandler ¶
SyncHandler is an interface implemented by Kubelet, for testability
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package config implements the pod configuration readers.
|
Package config implements the pod configuration readers. |