Ubuntu microk8s未运行。使用microk8s inspect进行更深入的检查

Ubuntu microk8s未运行。使用microk8s inspect进行更深入的检查,ubuntu,kubernetes,microk8s,Ubuntu,Kubernetes,Microk8s,重新启动VM后,microk8s停止运行 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 spec

重新启动VM后,microk8s停止运行

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?

我几乎尝试了所有的方法,但没有结果。

这里的端口不正确。应该是6443,而不是16443。您可以在/etc/kubernetes/kubelet.conf文件中更正主节点上的端口。

运行ps-ef | grep kubelet

输出有点像这样:

根9341508: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

查找kubelet.conf的路径,然后编辑该文件中的端口。在这个端口上,kubelet与kube apiserver连接。一旦修复,kubectl集群信息的输出应该是这样的:

Kubernetes控制飞机正以 库比登斯正在跑步
要进一步调试和诊断群集问题,请使用“kubectl cluster info dump”。

答案是:bash:/etc/kubernetes/kubelet.conf:没有这样的文件或目录OK,但是您的kubecofig在哪里?您是如何安装群集的?我更改了端口,它仍然指向16443。运行以下命令时:microk8s kubectl get pods:Connection to server 127.0.0.1 16443被拒绝您是否指定了正确的主机或端口?进行更改后,需要重新启动kubelet
systemctl守护进程重新加载
您还需要在所有节点(主节点和工作节点)上重新启动kubelets。对于工作节点,您需要ssh连接到它们中。