I install microk8s 1.28/stable on Ubuntu 22.04 LTS. It works OK.
After rebooting, when I run kubectl, sometime it works fine, and sometime it complains “The connection to the server 127.0.0.1:16443 was refused”. But I can access 127.0.0.1:16443 on FireFox.
Here are several outputs:
I can get node information, but sometime refused:
administer@gdsl1:~$ microk8s kubectl get node
NAME STATUS ROLES AGE VERSION
gdsl1 Ready <none> 46m v1.28.13
administer@gdsl1:~$ microk8s kubectl get node
The connection to the server 127.0.0.1:16443 was refused - did you specify the right host or port?
administer@gdsl1:~$ microk8s kubectl get node
NAME STATUS ROLES AGE VERSION
gdsl1 Ready <none> 46m v1.28.13
There is no error on the events:
administer@gdsl1:~$ microk8s kubectl get events -A
No resources found
administer@gdsl1:~$ microk8s kubectl get events -A
The connection to the server 127.0.0.1:16443 was refused - did you specify the right host or port?
Sometime I can see the cluster-info, sometime I cannot:
administer@gdsl1:~$ microk8s kubectl cluster-info
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server 127.0.0.1:16443 was refused - did you specify the right host or port?
administer@gdsl1:~$ microk8s kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:16443
CoreDNS is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Sorry I can not send the whole cluster-info dump file. But here are some errors from the output of “microk8s kubectl cluster-info dump”:
==== START logs for container calico-kube-controllers of pod kube-system/calico-kube-controllers-77bd7c5b-fb66f ====
Request log error: an error on the server ("unknown") has prevented the request from succeeding (get pods calico-kube-controllers-77bd7c5b-fb66f)
==== END logs for container calico-kube-controllers of pod kube-system/calico-kube-controllers-77bd7c5b-fb66f ====
==== START logs for container upgrade-ipam of pod kube-system/calico-node-8p4wj ====
Request log error: an error on the server ("unknown") has prevented the request from succeeding (get pods calico-node-8p4wj)
==== END logs for container upgrade-ipam of pod kube-system/calico-node-8p4wj ====
==== START logs for container install-cni of pod kube-system/calico-node-8p4wj ====
Request log error: an error on the server ("unknown") has prevented the request from succeeding (get pods calico-node-8p4wj)
==== END logs for container install-cni of pod kube-system/calico-node-8p4wj ====
==== START logs for container calico-node of pod kube-system/calico-node-8p4wj ====
Request log error: an error on the server ("unknown") has prevented the request from succeeding (get pods calico-node-8p4wj)
==== END logs for container calico-node of pod kube-system/calico-node-8p4wj ====
==== START logs for container coredns of pod kube-system/coredns-864597b5fd-m27bn ====
Request log error: an error on the server ("unknown") has prevented the request from succeeding (get pods coredns-864597b5fd-m27bn)
==== END logs for container coredns of pod kube-system/coredns-864597b5fd-m27bn ====
==== START logs for container dashboard-metrics-scraper of pod kube-system/dashboard-metrics-scraper-5657497c4c-jq4j2 ====
Request log error: an error on the server ("unknown") has prevented the request from succeeding (get pods dashboard-metrics-scraper-5657497c4c-jq4j2)
==== END logs for container dashboard-metrics-scraper of pod kube-system/dashboard-metrics-scraper-5657497c4c-jq4j2 ====
==== START logs for container hostpath-provisioner of pod kube-system/hostpath-provisioner-7df77bc496-s7cl8 ====
Request log error: an error on the server ("unknown") has prevented the request from succeeding (get pods hostpath-provisioner-7df77bc496-s7cl8)
==== END logs for container hostpath-provisioner of pod kube-system/hostpath-provisioner-7df77bc496-s7cl8 ====
==== START logs for container kubernetes-dashboard of pod kube-system/kubernetes-dashboard-54b48fbf9-lsxtk ====
Request log error: an error on the server ("unknown") has prevented the request from succeeding (get pods kubernetes-dashboard-54b48fbf9-lsxtk)
==== END logs for container kubernetes-dashboard of pod kube-system/kubernetes-dashboard-54b48fbf9-lsxtk ====
==== START logs for container metrics-server of pod kube-system/metrics-server-848968bdcd-6vhx4 ====
Request log error: an error on the server ("unknown") has prevented the request from succeeding (get pods metrics-server-848968bdcd-6vhx4)
==== END logs for container metrics-server of pod kube-system/metrics-server-848968bdcd-6vhx4 ====
Any idea how to solve it?
Thanks.