From the course: Certified Kubernetes Administrator (CKA) Cert Prep

Using metrics server to monitor node and Pod performance - Kubernetes Tutorial

From the course: Certified Kubernetes Administrator (CKA) Cert Prep

Using metrics server to monitor node and Pod performance

- In this video I'll show you how to use metrics server to monitor node and pod state. Kubernetes monitoring is offered by the integrated metrics server and this server after installation exposes a standard API and can be used to expose custom metrics. Use a kube CTL top utility to see a top like interface to provide resource usage information. And if this command shows no results, the metric server is not installed. So in this demo I'm going to show you how Kube CTL Top doesn't work without a metric server. And then we are going to install the metric server to check on the most active pods. So if you want to know more about the metric server, the metric server is not a part of vanilla Kubernetes. That makes it slightly complicated because where do we get this metric server? Well go to github.com/kubernetes-sigs SIGs are special interest groups and special interest groups are a part of the Kubernetes product itself, but it's not installed by default. And then metrics server.git that is showing the git, the git page for the metrics server with information about the metrics server and also information on how to install it. So here we get the kube CTL Apply command. Well let's just copy it over from here. That's also the approach that I would recommend on the exam. On the exam it can be hard to find the exact URL for the metric server. So what you need to remember is that Kube CTL top requires metrics hyphen server and this is a part of the Kubernetes-SIGs. The special interest groups. As long as you can remember Kubernetes SIGs, this should be doable. And then you can just copy paste the command from the website or there's a little bit of HML code in there. Let me clean it up and then this should be doing it. So here in the output we can see that a lot of stuff have has been created including some role based access control related stuff like surface account and the cluster role and the role binding and so on. For now that is good enough. We should have a metric server. So we need to verify if this metric server is available. And to do so, Kube CTL minus N kube system get pods is the thing to do. Now this looks good, doesn't it? Well if you look closely then you can see that the metrics server appears as a running and the ready is zero slash one and that means that it's not so good anyway, you might want to figure out what is going on, but I can tell you already what is going on. You need to configure the metrics server deployment to allow insecure TLS. Kube CTL logs should tell you more about this. So there you can see many TLS filled to verify messages and these filled to verify messages. That is what we are going to fix. So I'm going to use kube CTL edit minus n cube system on the deployment metrics server. And there we are going to fix it. And how are we going to fix it? Well, I'm scrolling down to the container arguments here we can see all the different startup arguments that this metric server is using. And in that list I'm adding kubelet insecure TLS. And now we need to wait for just a tiny little bit and then we should see something that is happening. To start it, you can see that five seconds ago it started running a new metric server pod. That is the the application update that is happening. And once it is done, the old metric server pod will go away. This might take up to one minute to complete. So be patient. So if you want to see what is going on, you can always use Kube CTL logs again. So Kube CTL minus N Kube system logs, metrics server. And this is giving more information and oh, guesses are synced for a client CA, well this is looking good enough so we should be all right and we should be able to do Kube CTL, top pods and Kube CTL Top pods. Well it's not very impressive because we only have one pod running. Let's put a minus a behind it and you can see it's giving CPU usage information, memory usage information about all the pods that are currently running.

Contents