Kubectl hangs or returns connection refused unexpected EOF

Hello everyone,

I’m currently experiencing issues with kubectl on my MicroK8s setup and would appreciate any help.
This issue appear suddenly on Monday, since then my cluster was running smooth

My current setup is as follows:

  • MicroK8s (Snap-based installation)

  • 1 control-plane node

  • 2 worker nodes

  • Calico as the CNI plugin

  • Kubernetes API served on 127.0.0.1:16443

Sometimes, kubectl commands like kubectl get ns runs smoothly, sometimes take a long time to respond, and sometimes i get the following error:

Get "https://127.0.0.1:16443/api/v1/namespaces?limit=500": dial tcp 127.0.0.1:16443: connect: connection refused – error from a previous attempt: unexpected EOF

Moreover, I realized that I can not delete resources for example the kubectl delete ns stuck in terminating state (even if the ns is empty).

I would appreciate any help, cause I don’t know what to do.

Thank you in advance.