kubelet

package
v1.16.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatRuntimeOperationErrorRate

func FormatRuntimeOperationErrorRate(nodesResult map[string]NodeRuntimeOperationErrorRate) string

FormatRuntimeOperationErrorRate formats the runtime operation error rate to string.

func GetKubeletHeapStats

func GetKubeletHeapStats(c clientset.Interface, nodeName string) (string, error)

GetKubeletHeapStats returns stats of kubelet heap.

func GetKubeletPods

func GetKubeletPods(c clientset.Interface, node string) (*v1.PodList, error)

GetKubeletPods retrieves the list of pods on the kubelet.

func GetKubeletRunningPods

func GetKubeletRunningPods(c clientset.Interface, node string) (*v1.PodList, error)

GetKubeletRunningPods retrieves the list of running pods on the kubelet. The pods includes necessary information (e.g., UID, name, namespace for pods/containers), but do not contain the full spec.

func GetStatsSummary

func GetStatsSummary(c clientset.Interface, nodeName string) (*kubeletstatsv1alpha1.Summary, error)

GetStatsSummary contacts kubelet for the container information.

func PrintAllKubeletPods

func PrintAllKubeletPods(c clientset.Interface, nodeName string)

PrintAllKubeletPods outputs status of all kubelet pods into log.

func ProxyRequest

func ProxyRequest(c clientset.Interface, node, endpoint string, port int) (restclient.Result, error)

ProxyRequest performs a get on a node proxy endpoint given the nodename and rest client.

func TargetContainers

func TargetContainers() []string

TargetContainers returns a list of containers for which we want to collect resource usage.

Types

type ContainerResourceUsage

type ContainerResourceUsage struct {
	Name                    string
	Timestamp               time.Time
	CPUUsageInCores         float64
	MemoryUsageInBytes      uint64
	MemoryWorkingSetInBytes uint64
	MemoryRSSInBytes        uint64
	// The interval used to calculate CPUUsageInCores.
	CPUInterval time.Duration
}

ContainerResourceUsage is a structure for gathering container resource usage.

type ContainersCPUSummary

type ContainersCPUSummary map[string]map[float64]float64

ContainersCPUSummary is indexed by the container name with each entry a (percentile, value) map.

type NodeRuntimeOperationErrorRate

type NodeRuntimeOperationErrorRate map[string]*RuntimeOperationErrorRate

NodeRuntimeOperationErrorRate is the runtime operation error rate on one node.

type NodesCPUSummary

type NodesCPUSummary map[string]ContainersCPUSummary

NodesCPUSummary is indexed by the node name with each entry a ContainersCPUSummary map.

type ResourceMonitor

type ResourceMonitor struct {
	// contains filtered or unexported fields
}

ResourceMonitor manages a resourceCollector per node.

func NewResourceMonitor

func NewResourceMonitor(c clientset.Interface, containerNames []string, pollingInterval time.Duration) *ResourceMonitor

NewResourceMonitor returns a new ResourceMonitor.

func (*ResourceMonitor) FormatCPUSummary

func (r *ResourceMonitor) FormatCPUSummary(summary NodesCPUSummary) string

FormatCPUSummary returns the string of human-readable CPU summary from the specified summary data.

func (*ResourceMonitor) FormatResourceUsage

func (r *ResourceMonitor) FormatResourceUsage(s ResourceUsagePerNode) string

FormatResourceUsage returns the formatted string for LogLatest(). TODO(oomichi): This can be made to local function after making test/e2e/node/kubelet_perf.go use LogLatest directly instead.

func (*ResourceMonitor) GetCPUSummary

func (r *ResourceMonitor) GetCPUSummary() NodesCPUSummary

GetCPUSummary returns summary of CPU.

func (*ResourceMonitor) GetLatest

func (r *ResourceMonitor) GetLatest() (ResourceUsagePerNode, error)

GetLatest returns the latest resource usage.

func (*ResourceMonitor) GetMasterNodeCPUSummary

func (r *ResourceMonitor) GetMasterNodeCPUSummary(summaryPerNode NodesCPUSummary) NodesCPUSummary

GetMasterNodeCPUSummary returns summary of master node CPUs.

func (*ResourceMonitor) GetMasterNodeLatest

func (r *ResourceMonitor) GetMasterNodeLatest(usagePerNode ResourceUsagePerNode) ResourceUsagePerNode

GetMasterNodeLatest returns the latest resource usage of master and node.

func (*ResourceMonitor) LogCPUSummary

func (r *ResourceMonitor) LogCPUSummary()

LogCPUSummary outputs summary of CPU into log.

func (*ResourceMonitor) LogLatest

func (r *ResourceMonitor) LogLatest()

LogLatest outputs the latest resource usage into log.

func (*ResourceMonitor) Reset

func (r *ResourceMonitor) Reset()

Reset resets collectors.

func (*ResourceMonitor) Start

func (r *ResourceMonitor) Start()

Start starts collectors.

func (*ResourceMonitor) Stop

func (r *ResourceMonitor) Stop()

Stop stops collectors.

type ResourceUsagePerContainer

type ResourceUsagePerContainer map[string]*ContainerResourceUsage

ResourceUsagePerContainer is map of ContainerResourceUsage

func GetOneTimeResourceUsageOnNode

func GetOneTimeResourceUsageOnNode(
	c clientset.Interface,
	nodeName string,
	cpuInterval time.Duration,
	containerNames func() []string,
) (ResourceUsagePerContainer, error)

GetOneTimeResourceUsageOnNode queries the node's /stats/summary endpoint and returns the resource usage of all containerNames for the past cpuInterval. The acceptable range of the interval is 2s~120s. Be warned that as the interval (and #containers) increases, the size of kubelet's response could be significant. E.g., the 60s interval stats for ~20 containers is ~1.5MB. Don't hammer the node with frequent, heavy requests.

cadvisor records cumulative cpu usage in nanoseconds, so we need to have two stats points to compute the cpu usage over the interval. Assuming cadvisor polls every second, we'd need to get N stats points for N-second interval. Note that this is an approximation and may not be accurate, hence we also write the actual interval used for calculation (based on the timestamps of the stats points in ContainerResourceUsage.CPUInterval.

containerNames is a function returning a collection of container names in which user is interested in.

type ResourceUsagePerNode

type ResourceUsagePerNode map[string]ResourceUsagePerContainer

ResourceUsagePerNode is map of ResourceUsagePerContainer.

type RuntimeOperationErrorRate

type RuntimeOperationErrorRate struct {
	TotalNumber float64
	ErrorRate   float64
	TimeoutRate float64
}

RuntimeOperationErrorRate is the error rate of a specified runtime operation.

type RuntimeOperationMonitor

type RuntimeOperationMonitor struct {
	// contains filtered or unexported fields
}

RuntimeOperationMonitor is the tool getting and parsing docker operation metrics.

func NewRuntimeOperationMonitor

func NewRuntimeOperationMonitor(c clientset.Interface) *RuntimeOperationMonitor

NewRuntimeOperationMonitor returns a new RuntimeOperationMonitor.

func (*RuntimeOperationMonitor) GetLatestRuntimeOperationErrorRate

func (m *RuntimeOperationMonitor) GetLatestRuntimeOperationErrorRate() map[string]NodeRuntimeOperationErrorRate

GetLatestRuntimeOperationErrorRate gets latest error rate and timeout rate from last observed RuntimeOperationErrorRate.

func (*RuntimeOperationMonitor) GetRuntimeOperationErrorRate

func (m *RuntimeOperationMonitor) GetRuntimeOperationErrorRate() map[string]NodeRuntimeOperationErrorRate

GetRuntimeOperationErrorRate gets runtime operation records from kubelet metrics and calculate error rates of all runtime operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL