Monitor Cluster Components
- How to monitor resource consumption?
- Kubernetes currently does not come with a monitoring solution.
- There are solutions available for this, those being:
- Metrics Server
- Prometheus
- Elastic Stack
- Datadog
- Dynatrace
- Heapster was an original project that allowed a lot of monitoring and analysis of a cluster for Kubernetes.
- Heapster is now deprecated and
Metrics Serveris a slimmed down version of that.
- Heapster is now deprecated and
- You can have one
Metrics Serverper cluster.- It retrieves metrics from each Kubernetes node and pod, gathers data and aggregates it.
- This is all done in memory.
- Not on disk.
- Cannot see historical performance data.
- How are the metrics generated on each node?
- Kubernetes has a
kubeletper node.- Response for receiving instructions from the Kubernetes API Master Server.
- Also for running pods on nodes.
- Contains a sub-component called
cAdvisor. Stands for Container Advisor.- This is responsible for collecting metrics from pods and exposing them with the
kubeletAPI. That then gets sent to theMetrics Server
- This is responsible for collecting metrics from pods and exposing them with the
- Kubernetes has a
- If you are using
minikube, then runminikube addons enable metrics-server - For other environments, run the following
git clonecommand:git clone https://github.com/kubernetes-incubator/metrics-server.git - Deploy the required components with the
kubectl create -fcommand, such askubectl create -f deploy/1.8+/- It deploys roles, pods and services to allow the
Metrics Serverto pole data from the cluster. - Performance data can then be viewed by running
kubectl top node- Shows CPU and Memory usage for nodes.
kubectl top podshows performance metrics of pods.
- It deploys roles, pods and services to allow the