Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start kubelet service?

Tags:

kubernetes

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 am not 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?
like image 348
Dhanraj Avatar asked Jun 05 '19 15:06

Dhanraj


2 Answers

Worked

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

like image 196
MOHAMED RAIYAN Avatar answered Sep 19 '22 09:09

MOHAMED RAIYAN


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

like image 25
Dhanraj Avatar answered Sep 20 '22 09:09

Dhanraj