I am trying to solve this problem below:
kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Unable to connect to the server: dial tcp 192.168.0.10:6443: i/o timeout
And i found answer on some stackoverflow post that i am trying to solve
$kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://192.168.0.10:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
And after that i wrote following command and got this below:
$ kubectl config use-context docker-for-desktop
error: no context exists with the name: "docker-for-desktop"
And after that i'am running sudo docker ps and i get this picture below:
How can I solve the Unable to connect to the server
error??
Unable to connect to the server: dial tcp 192.168.0.10:6443: i/o timeout
Above error means Kubernetes API Server which is supposed to listen on port 6443
is not running for issue in kubeadm init
process. This can be verified by checking if a kube API Server container is running or not by sudo docker ps | grep api
Disable swap and reboot machine
sudo swapoff -a
sudo sed -i '/ swap / s/^/#/' /etc/fstab
Uninstall and reinstall kubernetes by running below command
sudo kubeadm reset -f
sudo kubeadm init
As a sidenote if you are trying kubernetes on a local system I suggest to use minikube or kind instead of kubeadm.