Thursday, September 10, 2020

Kubernetes Metrics Server

 Before going to discuss about Metrics server, we need to understand why Metrics server required to monitor the resources of the pods or objects on the cluster,

 Early on, Kubernetes introduced Heapster as a tool that enables Container Cluster Monitoring and Performance Analysis for Kubernetes,its a default metrics manger in kubernetes, now it got deprecated and Kubernetes come up with Metric server, As Kubernetes continued growing, they started realising that a new, better, and, more importantly, a more extensible design is required. Hence, the metrics-server was developed.

we can get the assigned metrics like memory etc. by executing the command describe, but we wont get current running memory utilisation details.so in order to that we have to configure the metrics server.

Metrics server is like containerised application, which is running on controlplane nodes(master)

Metrics server will collect the utilisation from all the worker nodes  and stores the data in the database internally i.e  in-memory database, so auto-scaling engine will get the data from metrics server and it will make API call and process the auto scaling  accordingly.

now we configure the metrics server on the Kubernetes control-plane and see how it will use on the administration things,

i have made my cluster ready

before metrics server when i try to execute the top command for the kube-system pod, it gives an error related to the resource not found.

now i'm going to install and configure the metrics server in Master node i.e: control plane. i have only one master node so installing only on it, if we have 3 and more master nodes we have to install and configure the metrics server.

login to the Master server and install git to download the code from github with the below command.

git clone -b v0.3.4 https://github.com/kubernetes-sigs/metrics-server.git

go to the path : /root/metrics-server/deploy/1.8+

open the metrics-server-deployment.yaml file and add the below lines.  it should be under container. 

    command:

        - /metrics-server

        - --kubelet-insecure-tls

        - --kubelet-preferred-adress-types=InternalIP

and save the file.



then execute the command : kubectl apply/create -f .


then Metrics pod will be created under kube-system namespace.

kubectl get pods -n kube-system | grep metrics



we are done with the metrics-server install and configurations. it will take some time to get the all metrics from the kube-system namespace.

 kubectl top pods -n kube-system


we can cross check memory statistics of the nodes aswell.


we can any resource/object related statics will get by this configurations.

auto-scaling policy is that if any of the resource utilise more amount of the memory, Auto-scaling rule will enable to swin-up the new pod.




No comments:

Post a Comment