I have downloaded/installed Kubernetes, Virtual Box and MiniKube. Later, I started minikube on VM. When I try running kubectl version command from my terminal I receive the below error message. Could anybody tell me what is the reason behind this error. I have explored everywhere but I couldn't find right resolution for this problem. I am new to this and just taking baby steps. Any help would be appreciated. Thank you.
The connection to the server 192.168.99.100:8443 was refused - did you specify the right host or port?
Could anybody tell me what is the reason behind this error
It is because your kubectl
configuration file, housed at $HOME/.kube/config
, points at that IP address and port but there is nothing listening on that IP and port.
Using the minikube status
command will tell you what it thinks is going on, and minikube ssh
will place you inside the virtual machine and allow you to look around for yourself, which can be helpful to get the docker logs to say why there is nothing listening on the port you were expecting.
A good place to start is to run minikube ip
and see if it matches the IP address kubectl is expecting (as seen in the error message). If not, update your kubeconfig accordingly.
minikube ssh
and then
journalctl -u kubelet
The above should provide you with additional information about why the server is refusing connections.
This answer might also be helpful: How to diagnose Kubernetes not responding on API