microk8s is not running. use microk8s inspect for a deeper inspection

After restarting the VM, microk8s stopped running.

Executing this command outputs the following:
microk8s status:
microk8s is not running. use microk8s inspect for a deeper inspection.
microk8s kubectl get pod:
The connection to the server 127.0.0.1 16443 was refused did you specify the right host or port?

I have practically tried all the methods, but there is no result.

Upvotes: 5

Views: 9922

Answers (2)

Avnish Gupta
Avnish Gupta

Reputation: 123

Run ps -ef | grep kubelet

Output will be somewhat like this:

root 934 1 5 08:17 ? 00:20:40 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/pause:3.2

Look for path of kubelet.conf and then edit port in that file. On this port, kubelet connects with kube-apiserver. Once it's fixed, output of kubectl cluster-info should be somewhat like this:

Kubernetes control plane is running at https://192.168.56.2:6443 KubeDNS is running at https://192.168.56.2:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Upvotes: 3

Avnish Gupta
Avnish Gupta

Reputation: 123

Here the port is incorrect. It should be 6443 and not 16443. You can correct the port on master node in /etc/kubernetes/kubelet.conf file.

Upvotes: 2

Related Questions