How Do You Troubleshoot the Error “kubelet service is not enabled” or How Do You Write Your Own .service File in Linux?

Problem scenario
You try to run a kubeadm command. You get an error about kubelet

" [WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'"

How do you get "sudo systemctl start kubelet" or "sudo systemctl enable kubelet" to work? How do you create your own kubelet.service file?

Solution

  1. Create this file: /etc/systemd/system/kubelet.service
  2. The content should be as follows (but you may need to double check that the kubelet file is there; you may want to read "How do you manually install kubelet on any type of Linux?"):
[Unit]
Description=kubelet

[Service]
Type=simple
User=docker
Group=docker

ExecStart=/usr/bin/kubelet
Restart=always
WorkingDirectory=/
Nice=19

[Install]
WantedBy=multi-user.target

3. Now try these commands:

sudo systemctl start kubelet
sudo systemctl enable kubelet

(It may not stay on. But this can work for satisfying certain dependencies for proving experimental concepts. If you want the kubelet service to remain on and you are running a Red Hat derivative of Linux, see this posting.)

Leave a comment

Your email address will not be published. Required fields are marked *