Kubernetes - Montior and Debug Applications πΈοΈ
Description π
Kubernetes runs an agent on each node known as a kubelet. The kubelet is responsible for ensuring that the containers are running in a pod. The kubelet also exposes a /metrics/cadvisor endpoint that provides metrics about the node and its containers. The kubelet uses cAdvisor to collect these metrics. cAdvisor is an open source project that collects resource usage and performance metrics about running containers. cAdvisor is built into the kubelet binary and is available at the /metrics/cadvisor endpoint on the kubelet.
Metrics Server π
The metrics server is a cluster-wide aggregator of resource usage data. The metrics server collects resource metrics from all nodes in the cluster, aggregates the data, and exposes the metrics via an API. The metrics server is not enabled by default in Kubernetes. To enable the metrics server, you must install the metrics server.
-
minikubeinstallminikube addons enable metrics-server -
other
git clone https://github.com/kubernetes-incubator/metrics-servekubectl create -f deploy/1.8+/
Basic Commands π
-
view the metrics for the top performing
nodeskubectl top nodes -
view the metrics for the top performing
nodesin anamespacekubectl top nodes -n <namespace> -
view the
nodethat consumes the most memorykubectl top node --sort-by='memory' --no-headers | head -1 -
view the
nodethat consumes the least memorykubectl top node --sort-by='memory' --no-headers | tail -1 -
view the
nodethat consumes the most cpukubectl top node --sort-by='cpu' --no-headers | head -1 -
view the
nodethat consumes the most cpukubectl top node --sort-by='cpu' --no-headers | tail -1 -
view the metrics for the top performing
podskubectl top pods -
view the metrics for the top performing
podsin anamespacekubectl top pods -n <namespace> -
view the
podthat consumes the most memorykubectl top pod --sort-by='memory' --no-headers | head -1 -
view the
podthat consumes the least memorykubectl top pod --sort-by='memory' --no-headers | tail -1 -
view the
podthat consumes the most cpukubectl top pod --sort-by='cpu' --no-headers | head -1 -
view the
podthat consumes the most cpukubectl top pod --sort-by='cpu' --no-headers | tail -1