Hi all, I have just started Kubernetes, I installed it from the Kubernetes docu . . .

kanishk Pandey:
Hi all,

I have just started Kubernetes, I installed it from the Kubernetes document. Getting below error

root@dev-kanishk-cluster:~# kubectl get node
The connection to the server localhost:8080 was refused - did you specify the right host or port?

unnivkn:
@kanishk Pandey looks like your your kube-apiserver is not able to come up. please try to check the logs in the below sample path. eg: (/var/log/pods/kube-system-kube-apiserver…/kube-apiserver/3.log)

todoriri:
isn’t that due to missing config in $HOME/.kube/config ?

After installing the cluster, did you run the below in order to set the kubelet config?

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

kanishk Pandey:
@unnivkn /etc/kubernetes/admin.conf has not been created in my centos-7 machine

unnivkn:
https://stackoverflow.com/questions/66213199/config-not-found-etc-kubernetes-admin-conf-after-setting-up-kubeadm-worker

Did you try to start minikube ?

kubectl get node
 
The connection to the server localhost:8080 was refused - did you specify the right host or port?

 minikube   status
 
minikube
type: Control Plane
host: Stopped
kubelet: Stopped
apiserver: Stopped
kubeconfig: Stopped

minikube start

minikube   start
😄  minikube v1.20.0 sur Ubuntu 21.04
✨  Utilisation du pilote virtualbox basé sur le profil existant
👍  Démarrage du noeud de plan de contrôle minikube dans le cluster minikube
🎉  minikube 1.22.0 est disponible ! Téléchargez-le ici : https://github.com/kubernetes/minikube/releases/tag/v1.22.0
💡  To disable this notice, run: 'minikube config set WantUpdateNotification false'

🔄  Restarting existing virtualbox VM for "minikube" ...
🐳  Préparation de Kubernetes v1.20.2 sur Docker 20.10.6...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

kubectl get node

NAME       STATUS   ROLES                  AGE   VERSION:
minikube   Ready    control-plane,master   59d   v1.20.2

Good  Luck !