Kubelet failing start attempts pollutes logs

Viewed 119

I have a bunch of fresh CentOS servers installed on AWS. The service kubelet pollutes log file (var/log/messages) with it attempts to start, but as I have no use for it, I would like to remove it. It's this an optional component of CentOS and I can safely remove it (or disable kubelet.service)? I believe so, but would not expect a brand new server pushing out so many errors.

Currently, 97% of my /var/log/messages logs contain rows like:

Jan 17 03:21:03 systemd: Started kubelet: The Kubernetes Node Agent.  
Jan 17 03:21:03 kubelet: F0117 03:21:03.101812   29626 server.go:198] failed to load Kubelet  
 config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file 
"/var/lib/kubelet/config.yaml", error: open /var/lib/kubelet/config.yaml: no such file or 
directory
***da da da, 40 more rows***
Jan 17 03:21:03 systemd: Unit kubelet.service entered failed state.  
Jan 17 03:21:03 systemd: kubelet.service failed.  
Jan 17 03:21:13 systemd: kubelet.service holdoff time over, scheduling restart.  
Jan 17 03:21:13 systemd: Stopped kubelet: The Kubernetes Node Agent.  
Jan 17 03:21:13 systemd: Started kubelet: The Kubernetes Node Agent.  
***sleep for 10s and start all over*
1 Answers

As I have already mentioned in my comment, kubelet is a part of kubernetes cluster, it's the primary node agent that runs on each node. I sincerely doubt that this CentOS image came with it preinstalled. If it really did, and as you said, it's a "fresh CentOS server", that nobody had previously tinkered with, I would recommend you to choose a different image if your servers have nothing to do with kubernetes cluster. However if it is used as kind of your production environment and runs some other important things, you should investigate how it was installed and simply remove it.

I did not do the setup myself, but the template used is 258751437250/ami-centos-7-1.13.0-00-1543960911. We have not asked for Kubernetes on it and is not using clusters

The simplest answer to your question is:

You can safely stop and disable it so it doesn't pollute your /var/log/messages any more:

sudo systemctl stop kubelet.service && sudo systemctl disable kubelet.service

You can also remove it. Depending on how it was installed, you may need to do it in a specific way.

First check:

yum list installed | grep kubelet

If it's there you can:

yum remove kubelet

If it doesn't return any result you may try:

rpm -qa | grep kubelet

and if anything found, remove it:

rpm -e kubelet

It may be also a remnant of an old kubernetes installation which was set up with a tool like minikube or kubeadm. To check that, run:

sudo systemctl cat kubelet.service

and take a look at the ExecStart section. Depending on what you find there, it's very likely you'll need to uninstall some other unnecessary components e.g. if you find something like /var/lib/minikube/binaries/v1.16.0/kubelet, it means it's part of minikube installation.

Chances are that it was even partially uninstalled, but there are still some leftovers. As you can see, even it's config file cannot be found:

error: open /var/lib/kubelet/config.yaml: no such file or 
directory

In case of any doubts or additional questions, don't hesitate to ask.

Related