Error api-server

Hi everyone,

I was installing the control plane components according the video https://kodekloud.com/courses/539883/lectures/9808335

But I have found this error when i was trying to know the component status

vagrant@master-1:~$ kubectl get componentstatuses --kubeconfig admin.kubeconfig
The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?

Meanwhile i have inspected the systemd logs and I could see this message:

Jun 14 08:58:44 master-1 kube-controller-manager[3663]: E0614 08:58:44.825913 3663 leaderelection.go:320] error retrieving resource lock kube-system/kube-controller-manager: Get https://127.0.0.1:6443/api/v1/namespaces/kube-system/endpoints/kube-controller-manager?timeout=10s: dial tcp 127.0.0.1:6443: connect: connection refused
Jun 14 08:58:45 master-1 kube-scheduler[3671]: E0614 08:58:45.114131 3671 reflector.go:178] k8s.io/client-go/informers/factory.go:135: Failed to list *v1.Node: Get https://127.0.0.1:6443/api/v1/nodes?limit=500&resourceVersion=0: dial tcp 127.0.0.1:6443: connect: connection refused
Jun 14 08:58:46 master-1 systemd[1]: kube-apiserver.service: Service hold-off time over, scheduling restart.
Jun 14 08:58:46 master-1 systemd[1]: kube-apiserver.service: Scheduled restart job, restart counter is at 1939.
Jun 14 08:58:46 master-1 systemd[1]: Stopped Kubernetes API Server.

The API Server is not running correctly.

Shall anybody help me, please?

Thanks

I hope you did swapoff -a?

Please check systemctl status kubelet , check systemctl status docker

check env | grep -i kubeconfig current user should have Kubernetes cluster configuration environment variable.

yes, i did it, with the same problem

vagrant@master-1:~ sudo systemctl status kubelet Unit kubelet.service could not be found. vagrant@master-1:~ sudo systemctl status docker
Unit docker.service could not be found.
vagrant@master-1:~ env | grep -i kubeconfig vagrant@master-1:~

Install kubelet and docker. It’s not included in kubeadm. We have to install manually.