How to start kubelet service?

6/5/2019

I ran command systemctl stop kubelet then try to start it systemctl start kubelet

but can't able to start it

here is the output of systemctl status kubelet

 kubelet.service - kubelet: The Kubernetes Node Agent
   Loaded: loaded (/lib/systemd/system/kubelet.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/kubelet.service.d
           └─10-kubeadm.conf
   Active: activating (auto-restart) (Result: exit-code) since Wed 2019-06-05 15:35:34 UTC; 7s ago
     Docs: https://kubernetes.io/docs/home/
  Process: 31697 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=255)
 Main PID: 31697 (code=exited, status=255)

Because of this i can't able to run any kubectl command

example kubectl get pods gives

The connection to the server 172.31.6.149:6443 was refused - did you specify the right host or port?
-- Dhanraj
kubernetes

2 Answers

5/3/2020

Worked

Need to disable swap using swapoff -a then, try to start it systemctl start kubelet

-- MOHAMED RAIYAN
Source: StackOverflow

6/6/2019

So i need to reset kubelete service Here are the step :-

1) check status of your docker service. If stoped,start it by cmd sudo systemctl start docekr. If not installed installed it #yum install -y kubelet kubeadm kubectl docker

2) Make swap off by #swapoff -a

3)Now reset kubeadm by #kubeadm reset

4) Now try #kudeadm init after that check #systemctl status kubelet it will be working

Check nodes kubectl get nodes if Master Node is not ready ,refer following To start using your cluster, you need to run the following as a regular user:

mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

if you not able to create pod ..check dns kubectl get pods --namespace=kube-system if dns pods are in pending state i.e you need to use network service i used calico

kubectl apply -f https://docs.projectcalico.org/v3.7/manifests/calico.yaml

Now your master node is ready .. now you can deploy pod

-- Dhanraj
Source: StackOverflow